use the waypoint ctors/dtors/methods from r4721 directly.
authortsteven4@gmail.com <tsteven4@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 22 Jan 2014 03:43:56 +0000 (03:43 +0000)
committertsteven4@gmail.com <tsteven4@gmail.com@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Wed, 22 Jan 2014 03:43:56 +0000 (03:43 +0000)
this change was mostly done by a script with ed.

git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4722 f51c46e8-681c-474f-0cfe-069cfd0219fb

117 files changed:
gpsbabel/alan.cc
gpsbabel/an1.cc
gpsbabel/arcdist.cc
gpsbabel/bcr.cc
gpsbabel/bend.cc
gpsbabel/brauniger_iq.cc
gpsbabel/bushnell.cc
gpsbabel/bushnell_trl.cc
gpsbabel/compegps.cc
gpsbabel/cst.cc
gpsbabel/csv_util.cc
gpsbabel/delbin.cc
gpsbabel/delgpl.cc
gpsbabel/destinator.cc
gpsbabel/dg-100.cc
gpsbabel/discard.cc
gpsbabel/dmtlog.cc
gpsbabel/duplicate.cc
gpsbabel/easygps.cc
gpsbabel/enigma.cc
gpsbabel/exif.cc
gpsbabel/format_skeleton.cc
gpsbabel/g7towin.cc
gpsbabel/garmin.cc
gpsbabel/garmin_fit.cc
gpsbabel/garmin_gpi.cc
gpsbabel/garmin_txt.cc
gpsbabel/garmin_xt.cc
gpsbabel/gdb.cc
gpsbabel/geo.cc
gpsbabel/ggv_log.cc
gpsbabel/ggv_ovl.cc
gpsbabel/glogbook.cc
gpsbabel/gnav_trl.cc
gpsbabel/google.cc
gpsbabel/googledir.cc
gpsbabel/gopal.cc
gpsbabel/gpsutil.cc
gpsbabel/gpx.cc
gpsbabel/gtm.cc
gpsbabel/gtrnctr.cc
gpsbabel/hiketech.cc
gpsbabel/holux.cc
gpsbabel/humminbird.cc
gpsbabel/igc.cc
gpsbabel/ignrando.cc
gpsbabel/igo8.cc
gpsbabel/ik3d.cc
gpsbabel/interpolate.cc
gpsbabel/itracku.cc
gpsbabel/jogmap.cc
gpsbabel/jtr.cc
gpsbabel/kml.cc
gpsbabel/lmx.cc
gpsbabel/lowranceusr.cc
gpsbabel/lowranceusr4.cc
gpsbabel/maggeo.cc
gpsbabel/magproto.cc
gpsbabel/main.cc
gpsbabel/mapasia.cc
gpsbabel/mapbar_track.cc
gpsbabel/mapsend.cc
gpsbabel/mapsource.cc
gpsbabel/mmo.cc
gpsbabel/mtk_locus.cc
gpsbabel/mtk_logger.cc
gpsbabel/navicache.cc
gpsbabel/naviguide.cc
gpsbabel/navilink.cc
gpsbabel/navitel.cc
gpsbabel/netstumbler.cc
gpsbabel/nmea.cc
gpsbabel/nmn4.cc
gpsbabel/osm.cc
gpsbabel/overlay.cc
gpsbabel/ozi.cc
gpsbabel/pcx.cc
gpsbabel/pocketfms_bc.cc
gpsbabel/pocketfms_fp.cc
gpsbabel/pocketfms_wp.cc
gpsbabel/polygon.cc
gpsbabel/position.cc
gpsbabel/psitrex.cc
gpsbabel/radius.cc
gpsbabel/random.cc
gpsbabel/raymarine.cc
gpsbabel/route.cc
gpsbabel/saroute.cc
gpsbabel/sbn.cc
gpsbabel/shape.cc
gpsbabel/skyforce.cc
gpsbabel/skytraq.cc
gpsbabel/smplrout.cc
gpsbabel/stackfilter.cc
gpsbabel/stmsdf.cc
gpsbabel/stmwpp.cc
gpsbabel/tef_xml.cc
gpsbabel/teletype.cc
gpsbabel/tiger.cc
gpsbabel/tmpro.cc
gpsbabel/tomtom.cc
gpsbabel/tpg.cc
gpsbabel/tpo.cc
gpsbabel/trackfilter.cc
gpsbabel/transform.cc
gpsbabel/unicsv.cc
gpsbabel/v900.cc
gpsbabel/vidaone.cc
gpsbabel/vitosmt.cc
gpsbabel/vitovtt.cc
gpsbabel/vpl.cc
gpsbabel/waypt.cc
gpsbabel/wbt-200.cc
gpsbabel/wfff_xml.cc
gpsbabel/wintec_tes.cc
gpsbabel/xol.cc
gpsbabel/yahoo.cc

index e4b10901de47652ddcb22b0a6014c8a0d336b26a..661b416a85420e453cac3d3b0891b1a112665149 100644 (file)
@@ -508,7 +508,7 @@ static waypoint* get_wpt(struct wprdata* wprdata, unsigned n)
   }
   wpt = &(wprdata->wpt[idx]);
 
-  WP = waypt_new();
+  WP = new waypoint;
   WP->latitude  = -pt2deg(wpt->pt.y);
   WP->longitude =  pt2deg(wpt->pt.x);
   WP->SetCreationTime(unpack_time(wpt->date, wpt->time));
@@ -643,7 +643,7 @@ static void trl_read(void)
     /* track points */
     trklog = &(trldata.trklog[i]);
     for (j=0; j<trkhdr->totalpt; j++) {
-      WP = waypt_new();
+      WP = new waypoint;
       WP->latitude  = -pt2deg(trklog->pt[j].y);
       WP->longitude =  pt2deg(trklog->pt[j].x);
       WP->altitude  =  hgt2m(trklog->sh[j].height);
index 80bc8e1288ef9cbec380c7a9066d1ff544e03260..b9e51ad217f742d08774a2108a41c544044d4087 100644 (file)
@@ -699,7 +699,7 @@ static void Read_AN1_Waypoints(gbfile* f)
   for (i = 0; i < count; i++) {
     rec = Alloc_AN1_Waypoint();
     Read_AN1_Waypoint(f, rec);
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     if (rec->creation_time) {
       wpt_tmp->SetCreationTime(rec->creation_time);
@@ -874,7 +874,7 @@ static void Read_AN1_Lines(gbfile* f)
       Read_AN1_Vertex(f, vert);
 
       /* create route point */
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       wpt_tmp->latitude = DecodeOrd(vert->lat);
       wpt_tmp->longitude = -DecodeOrd(vert->lon);
       wpt_tmp->shortname = QString().sprintf("\\%5.5lx", rtserial++);
index d02ca206ffb8ada96c818d31016ca0cff6ce77ca..83bf867e25a2bd5bd14c471bc603045c5ebe372e 100644 (file)
@@ -164,8 +164,8 @@ arcdist_process(void)
 
     file_in = gbfopen(arcfileopt, "r", MYNAME);
 
-    arcpt1 = waypt_new();
-    arcpt2 = waypt_new();
+    arcpt1 = new waypoint;
+    arcpt2 = new waypoint;
     arcdist_arc_disp_hdr_cb(NULL);
 
     arcpt2->latitude = arcpt2->longitude = BADVAL;
@@ -195,8 +195,8 @@ arcdist_process(void)
         arcpt2 = arcpttmp;
       }
     }
-    waypt_free(arcpt1);
-    waypt_free(arcpt2);
+    delete arcpt1;
+    delete arcpt2;
 
     gbfclose(file_in);
   } else if (rteopt) {
@@ -218,7 +218,7 @@ arcdist_process(void)
     if (ed) {
       if ((ed->distance >= pos_dist) == (exclopt == NULL)) {
         waypt_del(wp);
-        waypt_free(wp);
+        delete wp;
         removed++;
       } else if (projectopt) {
         wp->longitude = ed->prjlongitude;
index 9c2d77fea5b18f2dfdc52742cb45bcfc47a8636a..18a3e073d1ee241d61806ac19845190de012c2a9 100644 (file)
@@ -218,7 +218,7 @@ bcr_create_waypts_from_route(route_head* route)
   queue* elem, *tmp;
 
   QUEUE_FOR_EACH(&route->waypoint_list, elem, tmp) {
-    wpt = waypt_dupe((waypoint*) elem);
+    wpt = new waypoint(*(waypoint*) elem);
     waypt_add(wpt);
   }
 }
@@ -286,7 +286,7 @@ bcr_data_read(void)
       fatal(MYNAME ": structure error at %s (Coordinates)!\n", station);
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->shortname = station;
     bcr_mercator_to_wgs84(mlat, mlon, &wpt->latitude, &wpt->longitude);
index ef7d58b91978d0f01a4705aaf52dcc7b010a6837..82861221261f6962ba1404909979462f792ee937 100644 (file)
@@ -90,7 +90,7 @@ create_wpt_dest(const waypoint* wpt_orig, double lat_orig,
   linepart(lat_orig, long_orig, lat_orig_adj, long_orig_adj, frac,
            &lat_dest, &long_dest);
 
-  wpt_dest = waypt_dupe(wpt_orig);
+  wpt_dest = new waypoint(*wpt_orig);
   wpt_dest->latitude = DEG(lat_dest);
   wpt_dest->longitude = DEG(long_dest);
 
@@ -126,7 +126,7 @@ process_route(const route_head* route_orig, route_head* route_dest)
 
     if (wpt_orig_prev == NULL) {
       if (wpt_orig != NULL) {
-        waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+        waypoint* waypoint_dest = new waypoint(*wpt_orig);
         route_add_wpt(route_dest, waypoint_dest);
       }
     } else {
@@ -142,7 +142,7 @@ process_route(const route_head* route_orig, route_head* route_dest)
 
       if (is_small_angle(lat_orig, long_orig, lat_orig_prev,
                          long_orig_prev, lat_orig_next, long_orig_next)) {
-        waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+        waypoint* waypoint_dest = new waypoint(*wpt_orig);
         route_add_wpt(route_dest, waypoint_dest);
       } else {
         waypoint* wpt_dest_prev = create_wpt_dest(wpt_orig,
@@ -166,7 +166,7 @@ process_route(const route_head* route_orig, route_head* route_dest)
   }
 
   if (wpt_orig != NULL) {
-    waypoint* waypoint_dest = waypt_dupe(wpt_orig);
+    waypoint* waypoint_dest = new waypoint(*wpt_orig);
     route_add_wpt(route_dest, waypoint_dest);
   }
 }
index a32f44a52a5f9a27611d1d64a61ef224508f6549..b96d160b7f019653c286e52caa075f21c5b8d06c 100644 (file)
@@ -200,7 +200,7 @@ static int process_data(const unsigned char* data)
     break;
 
   case st_sample_alt:
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = wpt->longitude = 0.0;
     wpt->SetCreationTime(creation);
     creation += interval;
index 5c712ab9d2f4f1530ee7a73c57fea9d854fcf602..856b6b0e05c53a22d82ea4d8eb44c77d9f3feb52 100644 (file)
@@ -205,7 +205,7 @@ bushnell_read(void)
   int32_t lat_tmp,lon_tmp;
   unsigned int proximity;
   unsigned int icon;
-  waypoint* wpt_tmp = waypt_new();
+  waypoint* wpt_tmp = new waypoint;
 
   lat_tmp = gbfgetint32(file_in);
   lon_tmp = gbfgetint32(file_in);
index 7ca941cb92cd2343d61a4bf580e76cbef81965da..26370d190192233221678ccf797135fed4f3af04 100644 (file)
@@ -106,7 +106,7 @@ bushnell_read(void)
       break;
     }
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
     wpt_tmp->latitude  = lat_tmp / 10000000.0;
     wpt_tmp->longitude = lon_tmp / 10000000.0;
 
index cd4e71efd84c2fcf993b6d1573d672a6fc8507cb..ca3f82e7253a8d0f296b02a9326d088190977d98 100644 (file)
@@ -160,7 +160,7 @@ parse_wpt(char* buff)
 {
   int col = -1;
   char* c, *cx;
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
   struct tm tm;
   int has_time = 0;
   memset(&tm, 0, sizeof(tm));
@@ -278,7 +278,7 @@ parse_trkpt(char* buff)
   int col = -1;
   char* c;
   struct tm tm;
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
 
   c = strstr(buff, "A ");
   if (c == buff) {
index 894eaf44fa11a0c6afdfc08d9f217b8550247077..cda0949fee83da76654d1668736622c5a11a291b 100644 (file)
@@ -59,9 +59,9 @@ cst_add_wpt(const route_head* track, waypoint* wpt)
   }
 
   if (wpt->shortname != NULL) {
-    waypt_add(waypt_dupe(wpt));
+    waypt_add(new waypoint(*wpt));
     // Rather than creating a new waypt on each read, tis format bizarrely
-    // recycles the same one, relying on waypt_dupe() above and then manually
+    // recycles the same one, relying on new waypoint(*) above and then manually
     // resetting fields.  Weird.
     wpt->url_link_list_.clear();
 
@@ -69,7 +69,7 @@ cst_add_wpt(const route_head* track, waypoint* wpt)
       temp_route = route_head_alloc();
       route_add_head(temp_route);
     }
-    route_add_wpt(temp_route, waypt_dupe(wpt));
+    route_add_wpt(temp_route, new waypoint(*wpt));
   }
   track_add_wpt((route_head*)track, (waypoint*)wpt);
 }
@@ -266,7 +266,7 @@ cst_data_read(void)
         wpt = NULL;
 
 
-        wpt = waypt_new();
+        wpt = new waypoint;
 
         if (5 != sscanf(cin, "%lf %lf %lf %d %s",
                         &wpt->longitude,
index e6e9136b108e5e3c1f98b36928936bf7ac9228ff..df8e1702ceaf6eff4b76e086ddae0b988385f9b0 100644 (file)
@@ -1243,33 +1243,33 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp,
   }
   break;
   case XT_GEOCACHE_LAST_FOUND:
-    waypt_alloc_gc_data(wpt)->last_found = yyyymmdd_to_time(s);
+    wpt->AllocGCData()->last_found = yyyymmdd_to_time(s);
     break;
 
     /* GEOCACHING STUFF ***************************************************/
   case XT_GEOCACHE_DIFF:
     /* Geocache Difficulty as an int */
-    waypt_alloc_gc_data(wpt)->diff = atof(s) * 10;
+    wpt->AllocGCData()->diff = atof(s) * 10;
     break;
   case XT_GEOCACHE_TERR:
     /* Geocache Terrain as an int */
-    waypt_alloc_gc_data(wpt)->terr = atof(s) * 10;
+    wpt->AllocGCData()->terr = atof(s) * 10;
     break;
   case XT_GEOCACHE_TYPE:
     /* Geocache Type */
-    waypt_alloc_gc_data(wpt)->type = gs_mktype(s);
+    wpt->AllocGCData()->type = gs_mktype(s);
     break;
   case XT_GEOCACHE_CONTAINER:
-    waypt_alloc_gc_data(wpt)->container = gs_mkcont(s);
+    wpt->AllocGCData()->container = gs_mkcont(s);
     break;
   case XT_GEOCACHE_HINT:
-    waypt_alloc_gc_data(wpt)->hint = QString(s).trimmed();
+    wpt->AllocGCData()->hint = QString(s).trimmed();
     break;
   case XT_GEOCACHE_PLACER:
-    waypt_alloc_gc_data(wpt)->placer = QString(s).trimmed();
+    wpt->AllocGCData()->placer = QString(s).trimmed();
     break;
   case XT_GEOCACHE_ISAVAILABLE:
-    gc_data = waypt_alloc_gc_data(wpt);
+    gc_data = wpt->AllocGCData();
     if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) {
       gc_data->is_available = status_false;
     } else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) {
@@ -1279,7 +1279,7 @@ xcsv_parse_val(const char* s, waypoint* wpt, const field_map_t* fmp,
     }
     break;
   case XT_GEOCACHE_ISARCHIVED:
-    gc_data = waypt_alloc_gc_data(wpt);
+    gc_data = wpt->AllocGCData();
     if (case_ignore_strcmp(csv_stringtrim(s, ""), "False") == 0) {
       gc_data->is_archived = status_false;
     } else if (case_ignore_strcmp(csv_stringtrim(s, ""), "True") == 0) {
@@ -1473,7 +1473,7 @@ xcsv_data_read(void)
     }
 
     if (strlen(buff)) {
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       s = buff;
       s = csv_lineparse(s, xcsv_file.field_delimiter,
index 08c47d1e546b8379920d96dae21c31f36a08930d..fcb2cd450ac0da4691067c09c12b49178b0e3742 100644 (file)
@@ -994,7 +994,7 @@ decode_time(const uint8_t* p)
 static waypoint*
 decode_waypoint(const void* data)
 {
-  waypoint* wp = waypt_new();
+  waypoint* wp = new waypoint;
   const msg_waypoint_t* p = (const msg_waypoint_t*)data;
   const char* s;
   float f;
@@ -1400,7 +1400,7 @@ write_waypoint(const waypoint* wp)
   float elev = UNKNOWN_ELEV;
   char* pp;
 
-  if (waypt_empty_gc_data(wp)) {
+  if (wp->EmptyGCData()) {
     notes = xstrdup(wp->notes);
     if (notes == NULL && wp->description.isEmpty() && wp->shortname != wp->description) {
       notes = xstrdup(wp->description);
@@ -1554,7 +1554,7 @@ decode_track_point(const void* data, unsigned* wp_array_i, unsigned max_point)
     fatal(MYNAME ": read too many track points\n");
   }
   for (i = 0; i < n; i++, j++) {
-    waypoint* wp = waypt_new();
+    waypoint* wp = new waypoint;
     float elev = le_read_float(p->point[i].elevation);
     wp_array[j] = wp;
     wp->SetCreationTime(decode_time(&p->point[i].year));
@@ -1863,7 +1863,7 @@ decode_route_shape(const void* data, unsigned* wp_array_i)
 
   for (i = 0; i < n; i++, j++) {
     char buf[32];
-    waypoint* wp = waypt_new();
+    waypoint* wp = new waypoint;
     wp_array[j] = wp;
     wp->latitude = delbin_rad2deg(le_read32(p->point[i].latitude));
     wp->longitude = delbin_rad2deg(le_read32(p->point[i].longitude));
@@ -1879,7 +1879,7 @@ decode_route_point(const void* data)
   const msg_route_point_t* p = (const msg_route_point_t*) data;
   const char* s = NULL;
   gbfile* fd = gbfopen(NULL, "w", MYNAME);
-  waypoint* wp = waypt_new();
+  waypoint* wp = new waypoint;
   if (p->name[0]) {
     wp->shortname = p->name;
   }
@@ -2265,7 +2265,7 @@ write_routes(void)
 static waypoint*
 decode_navmsg(const void* data)
 {
-  waypoint* wp = waypt_new();
+  waypoint* wp = new waypoint;
   const msg_navigation_t* p = (const msg_navigation_t*) data;
   struct tm t;
 
index eb83d11e7f801ec67772d659da0a170951aa7ee1..e240980f29026a3132ee7a3a8232f053db69c81d 100644 (file)
@@ -63,7 +63,7 @@ gpl_read(void)
   track_add_head(track_head);
 
   while (gbfread(&gp, sizeof(gp), 1, gplfile_in) > 0) {
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
     wpt_tmp->latitude = le_read_double(&gp.lat);
     wpt_tmp->longitude = le_read_double(&gp.lon);
     alt_feet = le_read_double(&gp.alt);
@@ -95,7 +95,7 @@ gpl_read(void)
     // in time.  The only thing I see "special" about those
     // trackpoints is that these fields are zeroed.  Toss them.
     if ((wpt_tmp->speed == 0.0) && (wpt_tmp->course == 0.0)) {
-      waypt_free(wpt_tmp);
+      delete wpt_tmp;
       continue;
     }
     track_add_wpt(track_head, wpt_tmp);
index 87344d1e9ebf0b71d95a24bf2cf582ce427afed7..379205fe56fdf7b31e23ef16183dd155b5fe8706 100644 (file)
@@ -172,7 +172,7 @@ destinator_read_poi(void)
 
     count++;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->shortname = read_wcstr(0);
     wpt->notes = read_wcstr(0);                /* comment */
@@ -247,7 +247,7 @@ destinator_read_rte(void)
 
     count++;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->shortname = read_wcstr(0);
     wpt->notes = read_wcstr(0);
@@ -297,7 +297,7 @@ destinator_read_trk(void)
       break;
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->longitude = gbfgetdbl(fin);
     wpt->latitude = gbfgetdbl(fin);
index b8ad6d5d483e4167016bb6777b7b5706507d8dd5..b51a39fbe0e71135c0d8c1350076903458d29f47 100644 (file)
@@ -266,7 +266,7 @@ process_gpsfile(uint8_t data[], route_head** track)
       track_add_head(*track);
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     latitude = bin2deg(lat);
     if (latitude >= 100) {
       manual_point = 1;
index fae15929996f54d476bd7eb08afe7e2a347c1e17..5ebe298a08f34806373cb8ab94fd82bc6b451cfd 100644 (file)
@@ -135,7 +135,7 @@ fix_process_wpt(const waypoint* wpt)
     default:
       return;
     }
-    waypt_free(waypointp);
+    delete waypointp;
   }
 }
 
index 8a153dd9be6706cd04d3f4f4f812442ba9a205d2..ef27bb95f50984158ce89498336f17a6c97d0218 100644 (file)
@@ -253,7 +253,7 @@ tlog3b_xgcb_tfdes(xg_string args, const QXmlStreamAttributes* unused)
 static void
 tlog3b_xgcb_wptst(xg_string args, const QXmlStreamAttributes* unused)
 {
-  xmlwpt = waypt_new();
+  xmlwpt = new waypoint;
   xmldatum = DATUM_WGS84;
 }
 
@@ -261,7 +261,7 @@ tlog3b_xgcb_wptst(xg_string args, const QXmlStreamAttributes* unused)
 static void
 tlog3b_xgcb_tptst(xg_string args, const QXmlStreamAttributes* unused)
 {
-  xmlwpt = waypt_new();
+  xmlwpt = new waypoint;
   xmldatum = DATUM_WGS84;
 }
 
@@ -481,7 +481,7 @@ read_CTrackFile(const int version)
       datum = read_datum(fin);
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->latitude = gbfgetdbl(fin);
     wpt->longitude = gbfgetdbl(fin);
@@ -527,7 +527,7 @@ read_CTrackFile(const int version)
       gbfungetc(i, fin);
       datum = read_datum(fin);
 
-      wpt = waypt_new();
+      wpt = new waypoint;
 
       wpt->latitude = gbfgetdbl(fin);
       wpt->longitude = gbfgetdbl(fin);
@@ -557,7 +557,7 @@ read_CTrackFile(const int version)
 
     wcount--;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->latitude = gbfgetdbl(fin);
     wpt->longitude = gbfgetdbl(fin);
index d723a5040fc8784d622716e7d6458b2d2db227da..338ca5cfd1b68d8985cfb4b943706b5268b53264 100644 (file)
@@ -233,7 +233,7 @@ duplicate_process(void)
 
     if (btmp == NULL) {
       if (delwpt) {
-        waypt_free(delwpt);
+        delete delwpt;
       }
       if (correct_coords && oldnode && oldnode->wpt) {
         oldnode->wpt->latitude = waypointp->latitude;
@@ -245,7 +245,7 @@ duplicate_process(void)
       if (purge_duplicates && oldnode) {
         if (oldnode->wpt) {
           waypt_del(oldnode->wpt);
-          waypt_free(oldnode->wpt);
+          delete oldnode->wpt;
           oldnode->wpt = NULL;
         }
       }
@@ -256,7 +256,7 @@ duplicate_process(void)
   }
 
   if (delwpt) {
-    waypt_free(delwpt);
+    delete delwpt;
   }
 
   xfree(htable);
index 7c25eb0aeb97944895194baee3092503a71b918b..52fa6acc1036785d24b4dc1eb22ccbcbd2038119 100644 (file)
@@ -83,7 +83,7 @@ data_read(void)
     unsigned char tag;
     waypoint* wpt_tmp;
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
     UrlLink link;
 
     for (tag = gbfgetc(file_in); tag != 0xff; tag = gbfgetc(file_in)) {
index 30d571e4899ae07751c106909ee99bb39526b3e1..7272fa4f3b459031c46498d7374f0b509a46eac6 100644 (file)
@@ -108,7 +108,7 @@ data_read(void)
   route_add_head(route);
 
   while (1 == gbfread(&ewpt, sizeof(ewpt), 1, file_in)) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
     wpt->latitude = enigmaPositionToDec(le_read32(&ewpt.latitude));
     wpt->longitude = enigmaPositionToDec(le_read32(&ewpt.longitude));
     char*sn = xstrndup(ewpt.shortname, ewpt.shortname_len);
index 7f92bcf4fc9798d3819ab63608920244a1d22666..8eb739744f864920d2b3d104079ddfd870f051a2 100644 (file)
@@ -693,7 +693,7 @@ exif_waypt_from_exif_app(exif_app_t* app)
     return NULL;
   }
 
-  wpt = waypt_new();
+  wpt = new waypoint;
 
   wpt->latitude = unknown_alt;
   wpt->longitude = unknown_alt;
index 78a87b72de00ae84fbb976099613e532be259e4a..28db1451e678d68e51f142704079a1d5b092d1aa 100644 (file)
@@ -84,7 +84,7 @@ format_skeleton_read(void)
 //
 // For waypoints:
 //         while (have waypoints) {
-//                 waypoint = waypt_new()
+//                 waypoint = new waypoint
 //                 populate waypoint
 //                 waypt_add(waypoint);
 //         }
@@ -95,7 +95,7 @@ format_skeleton_read(void)
 //         populate struct route_hdr
 //        route_add_head(route);
 //         while (have more routepoints) {
-//                 waypoint = waypt_new()
+//                 waypoint = new waypoint
 //                 populate waypoint
 //                 route_add_wpt(route, waypoint)
 //         }
index 67c22ab2712174bbc986dcb66c20541912a6a579..2121de35506c5a80cb39c311d5beec30a1d070d1 100644 (file)
@@ -273,7 +273,7 @@ parse_waypt(char* buff)
   waypoint* wpt;
   garmin_fs_p gmsd;
 
-  wpt = waypt_new();
+  wpt = new waypoint;
   gmsd = garmin_fs_alloc(-1);
   fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
 
@@ -347,7 +347,7 @@ parse_trkpt(char* buff)
   garmin_fs_p gmsd;
   waypoint* wpt;
 
-  wpt = waypt_new();
+  wpt = new waypoint;
   gmsd = garmin_fs_alloc(-1);
   fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
 
@@ -459,7 +459,7 @@ data_read(void)
       break;
 
     case 'I': /* event point */
-      wpt = waypt_new();
+      wpt = new waypoint;
       cdata += parse_coordinates(cdata, datum, grid,
                                  &wpt->latitude, &wpt->longitude, MYNAME);
       xasprintf(&wpt->shortname, "Event%d", ++event_ct);
index b6f9c4dbce7769f478c35c6adc9b43868cb0bd18..3e17716dd841ad3f0a759e25ac5bf3cbea33304b 100644 (file)
@@ -338,7 +338,7 @@ waypt_read(void)
   GPS_PWay* way = NULL;
 
   if (getposn) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
     wpt->latitude = gps_save_lat;
     wpt->longitude = gps_save_lon;
     wpt->shortname = "Position";
@@ -354,7 +354,7 @@ waypt_read(void)
   }
 
   for (i = 0; i < n; i++) {
-    waypoint* wpt_tmp = waypt_new();
+    waypoint* wpt_tmp = new waypoint;
 
     wpt_tmp->shortname = way[i]->ident;
     wpt_tmp->description = QString(way[i]->cmnt).simplified();
@@ -491,7 +491,7 @@ track_read(void)
     if (array[i]->no_latlon || array[i]->ishdr) {
       continue;
     }
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->longitude = array[i]->lon;
     wpt->latitude = array[i]->lat;
@@ -563,7 +563,7 @@ route_read(void)
       if (array[i]->islink)  {
         continue;
       } else {
-        waypoint* wpt_tmp = waypt_new();
+        waypoint* wpt_tmp = new waypoint;
         wpt_tmp->latitude = array[i]->lat;
         wpt_tmp->longitude = array[i]->lon;
         wpt_tmp->shortname = array[i]->ident;
@@ -618,7 +618,7 @@ lap_read_as_track(void)
       trk_head->rte_name = tbuf;
       track_add_head(trk_head);
 
-      wpt = waypt_new();
+      wpt = new waypoint;
 
       wpt->longitude = array[i]->begin_lon;
       wpt->latitude = array[i]->begin_lat;
@@ -641,7 +641,7 @@ lap_read_as_track(void)
     *                  continue;
     *          }
     */
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->longitude = array[i]->end_lon;
     wpt->latitude = array[i]->end_lat;
@@ -749,7 +749,7 @@ pvt_init(const char* fname)
 static waypoint*
 pvt_read(posn_status* posn_status)
 {
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
   GPS_PPvt_Data pvt = GPS_Pvt_New();
 
   if (GPS_Command_Pvt_Get(&pvt_fd, &pvt)) {
@@ -773,7 +773,7 @@ pvt_read(posn_status* posn_status)
     fatal(MYNAME ": Fatal error reading position.\n");
   }
 
-  waypt_free(wpt);
+  delete wpt;
   GPS_Pvt_Del(&pvt);
 
   return NULL;
index 0f523c2d61a2b9467d16e05530b11e589f3ecccf..03c629f26f904f4e900eb825114c6e25c89ad854 100644 (file)
@@ -380,7 +380,7 @@ fit_parse_data(fit_message_def* def, int time_offset)
       break;
     }
 
-    waypt = waypt_new();
+    waypt = new waypoint;
     waypt->latitude = (lat / (double)0x7fffffff) * 180;
     waypt->longitude = (lon / (double)0x7fffffff) * 180;
     if (alt != 0xffff) {
index c14956c71572e9b42d3a138e1b8b60bb65f9d68c..316496be96c74a481e83a44f5373e54a8ae8feed 100644 (file)
@@ -388,7 +388,7 @@ read_poi(const int sz, const int tag)
   (void) len;
   pos = gbftell(fin);
 
-  wpt = waypt_new();
+  wpt = new waypoint;
   wpt->icon_descr = DEFAULT_ICON;
 
   wpt->latitude = GPS_Math_Semi_To_Deg(gbfgetint32(fin));
@@ -824,7 +824,7 @@ wdata_free(writer_data_t* data)
       }
       xfree(dt);
     }
-    waypt_free(wpt);
+    delete wpt;
   }
 
   if (data->top_left) {
@@ -1300,7 +1300,7 @@ enum_waypt_cb(const waypoint* ref)
     }
   }
 
-  wpt = waypt_dupe(ref);
+  wpt = new waypoint(*ref);
 
   if (*opt_unique == '1') {
 #if NEW_STRINGS
index 8881654e4a6c895104374d5a3bf72c7fdd0642a6..59edaaf68ad400d0219cba58528fd51c50937e0d 100644 (file)
@@ -1141,7 +1141,7 @@ parse_waypoint(void)
 
   bind_fields(waypt_header);
 
-  wpt = waypt_new();
+  wpt = new waypoint;
   gmsd = garmin_fs_alloc(-1);
   fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
 
@@ -1300,7 +1300,7 @@ parse_route_waypoint(void)
       is_fatal((*str == '\0'), MYNAME ": Route waypoint without name at line %d!\n", current_line);
       wpt = find_waypt_by_name(str);
       is_fatal((wpt == NULL), MYNAME ": Route waypoint \"%s\" not in waypoint list (line %d)!\n", str, current_line);
-      wpt = waypt_dupe(wpt);
+      wpt = new waypoint(*wpt);
       break;
     }
   }
@@ -1317,7 +1317,7 @@ parse_track_waypoint(void)
   waypoint* wpt;
 
   bind_fields(trkpt_header);
-  wpt = waypt_new();
+  wpt = new waypoint;
 
   while ((str = csv_lineparse(NULL, "\t", "", column++))) {
     int field_no;
index 4178261a5d747f09b7061db4cde3491046fdaccb..c986237613bcd8fe5600c4532fefab4254b5400b 100644 (file)
@@ -293,7 +293,7 @@ format_garmin_xt_proc_strk(void)
         // Add point to the track if not the first point
         if (!FirstCoo) {
           //create new waypoint
-          wpt = waypt_new();
+          wpt = new waypoint;
 
           //populate wpt;
           wpt->latitude = PrevLat;     /* Degrees */
@@ -319,7 +319,7 @@ format_garmin_xt_proc_strk(void)
     format_garmin_xt_decomp_last_ele(Count, &PrevEle, TrackBlock);
 
     //create new waypoint
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     //populate wpt;
     wpt->latitude = PrevLat;   /* Degrees */
@@ -391,7 +391,7 @@ format_garmin_xt_proc_atrk(void)
     AltF = (double)uu * GARMIN_XT_ELE - 1500;
 
     //create new waypoint
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     //populate wpt;
     wpt->latitude = LatF*180/16777216; /* Degrees */
index 32f227b1acff93af6644518549236d3c2c463247..1f4c1ba8a22f756ced3329f3e40f639a43111240 100644 (file)
@@ -161,7 +161,7 @@ gdb_flush_waypt_queue(queue* Q)
       xfree(wpt->extra_data);
 #endif
     }
-    waypt_free(wpt);
+    delete wpt;
   }
 }
 
@@ -411,10 +411,10 @@ gdb_add_route_waypt(route_head* rte, waypoint* ref, const int wpt_class)
   turn_point = (gdb_roadbook && (wpt_class > gt_waypt_class_map_point) && tmp->description);
 #endif
   if (turn_point || (gdb_via == 0) || (wpt_class < gt_waypt_class_map_point)) {
-    res = waypt_dupe(tmp);
+    res = new waypoint(*tmp);
     route_add_wpt(rte, res);
   }
-  waypt_free(ref);
+  delete ref;
   return res;
 }
 
@@ -555,7 +555,7 @@ read_waypoint(gt_waypt_classes_e* waypt_class_out)
   char* sn;
 #endif
   waypt_ct++;
-  res = waypt_new();
+  res = new waypoint;
 
   gmsd = garmin_fs_alloc(-1);
   fs_chain_add(&res->fs, (format_specific_data*) gmsd);
@@ -839,7 +839,7 @@ read_route(void)
 
     waypoint* wpt;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     rtept_ct++;
 
     wpt->shortname = fread_cstr();     /* shortname */
@@ -936,8 +936,8 @@ read_route(void)
       /* Without links we need all informations from wpt */
       waypoint* tmp = gdb_reader_find_waypt(wpt, 0);
       if (tmp != NULL) {
-        waypt_free(wpt);
-        wpt = waypt_dupe(tmp);
+        delete wpt;
+        wpt = new waypoint(*tmp);
       } else {
         if (waypt_bounds_valid(&bounds)) {
           warning(MYNAME ": (has bounds)\n");
@@ -1029,7 +1029,7 @@ read_track(void)
   points = FREAD_i32;
 
   for (index = 0; index < points; index++) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
 
     trkpt_ct++;
 
@@ -1146,7 +1146,7 @@ read_data(void)
       if ((gdb_via == 0) || (wpt_class == 0)) {
         waypoint* dupe;
         waypt_add(wpt);
-        dupe = waypt_dupe(wpt);
+        dupe = new waypoint(*wpt);
         ENQUEUE_TAIL(&wayptq_in, &dupe->Q);
       } else {
         ENQUEUE_TAIL(&wayptq_in_hidden, &wpt->Q);
@@ -1761,7 +1761,7 @@ write_waypoint_cb(const waypoint* refpt)
 #else
     char* name;
 #endif
-    waypoint* wpt = waypt_dupe(refpt);
+    waypoint* wpt = new waypoint(*refpt);
 
     gdb_check_waypt(wpt);
     ENQUEUE_TAIL(&wayptq_out, &wpt->Q);
index 1fb260b26a8dd92c2f13a5614ab8af3ffcd561e4..d9367666b25991d5cb1a9a23fc1bed92453e4e42 100644 (file)
@@ -58,8 +58,8 @@ void GeoReadLoc()
       current_tag.append("/");
       current_tag.append(tag_name);
       if (current_tag == "/loc/waypoint") {
-        wpt = waypt_new();
-        waypt_alloc_gc_data(wpt);
+        wpt = new waypoint;
+        wpt->AllocGCData();
         // There is no 'unknown' alt value and so many reference files have
         // leaked it that we just paper over that here.
         wpt->altitude = 0;
index 71850ebca2c07fdfbba49267c48612803ee8fb32..a81a4ed76e77611c4c5e811199954b2926ac0967 100644 (file)
@@ -124,7 +124,7 @@ ggv_log_read(void)
 
     memset(&tm, 0, sizeof(tm));
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     deg = (int16_t) le_read16(&buf[0]);
     min = le_read16(&buf[2]);
index cd68c551e458539e0fca130e116d80c6d81ca0cc..bf6ce7880e459e97e08bb249f56b46eda19b2bbf 100644 (file)
@@ -146,7 +146,7 @@ ggv_ovl_read(void)
 
         for (j = 0; j < points; j++) {
 
-          wpt = waypt_new();
+          wpt = new waypoint;
 
           snprintf(coord, sizeof(coord), "YKoord%d", j);
           if ((cx = inifile_readstr(inifile, symbol, coord))) {
@@ -174,7 +174,7 @@ ggv_ovl_read(void)
     case OVL_SYMBOL_CIRCLE:
     case OVL_SYMBOL_TRIANGLE:
 
-      wpt = waypt_new();
+      wpt = new waypoint;
       wpt->shortname = symbol;
 
       if ((cx = inifile_readstr(inifile, symbol, "YKoord"))) {
index ad985d26910bdb38f37c4ac88d38da59bb43b28b..2aa0d0eea13de90f56545a8031c9f666052cafd0 100644 (file)
@@ -147,7 +147,7 @@ void        gl_trk_s(xg_string args, const QXmlStreamAttributes* unused)
 
 void   gl_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 void   gl_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused)
index c485578479dfafebcd7ab30cfae573860583d33a..36d4bde705d26e549ebfb5cab60d591e6d9966c1 100644 (file)
@@ -98,7 +98,7 @@ gnav_trl_read(void)
       fatal(MYNAME ": Unexpected EOF (end of file)!\n");
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->SetCreationTime(le_read32(&rec.time));
     wpt->latitude = le_read_float(&rec.lat);
index 0ab3e5fd8383b05d57ad2280a889494a3af01aa2..9970cbd26b1b67dfaae81289f1ef8cc70b669837 100644 (file)
@@ -243,7 +243,7 @@ void goog_poly_e(xg_string args, const QXmlStreamAttributes* unused)
     }
 
     {
-      waypoint* wpt_tmp = waypt_new();
+      waypoint* wpt_tmp = new waypoint;
       wpt_tmp->latitude = lat / 100000.0;
       wpt_tmp->longitude = lon / 100000.0;
       wpt_tmp->route_priority=level;
index f9dc44c32f7853faa5e82e47a44c8852d016ed31..66e92f9f9930756f380d462e9fe87c3ad0a35c9e 100644 (file)
@@ -126,7 +126,7 @@ goog_poly_e(xg_string args, const QXmlStreamAttributes* unused)
     lon += decode_goog64(&str);
 
     {
-      waypoint* wpt_tmp = waypt_new();
+      waypoint* wpt_tmp = new waypoint;
       wpt_tmp->latitude = lat / 100000.0;
       wpt_tmp->longitude = lon / 100000.0;
       /* FIXME no need for name
index 72106488cb5e32fbb2604b024836c471829eefa0..06293a7351f4c85b560444da687172f41be1ff70 100644 (file)
@@ -206,7 +206,7 @@ gopal_read(void)
     if ((nfields == 8) && (tx == 0)) {
       // fatal(MYNAME ": Invalid date in filename \"%s\", try to set manually using \"date\" switch!\n", buff);
     }
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     column = -1;
     // the format of gopal is quite simple. Unfortunately the developers forgot the date as the first element...
@@ -333,7 +333,7 @@ gopal_read(void)
       long_old=wpt->longitude;
       lat_old=wpt->latitude;
       route_add_wpt(route,wpt);
-      waypt_add(waypt_dupe(wpt));
+      waypt_add(new waypoint(*wpt));
     }
   }
 }
index 92042666067b341adeded79d1913397094ba08b0..264750a0cc096376372eb9882a5ef1a25a347692 100644 (file)
@@ -110,7 +110,7 @@ data_read(void)
     rtrim(sn);
     rtrim(desc);
     rtrim(icon);
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
     wpt_tmp->altitude = alt;
     wpt_tmp->shortname = sn;
     xfree(sn);
index 5b554fd8bc9e22c7f99e7ef85d124f5013b7a0c4..4c4bdf4d17ec3247d9a675fda80fa329387e21eb 100644 (file)
@@ -490,7 +490,7 @@ tag_gpx(const QXmlStreamAttributes& attr)
 static void
 tag_wpt(const QXmlStreamAttributes& attr)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
   link_ = new UrlLink;
 
   cur_tag = NULL;
@@ -517,7 +517,7 @@ tag_cache_desc(const QXmlStreamAttributes& attr)
 static void
 tag_gs_cache(const QXmlStreamAttributes& attr)
 {
-  geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+  geocache_data* gc_data = wpt_tmp->AllocGCData();
 
   if (attr.hasAttribute("id")) {
     gc_data->id = attr.value("id").toString().toInt();
@@ -608,7 +608,7 @@ static void
 tag_log_wpt(const QXmlStreamAttributes& attr)
 {
   /* create a new waypoint */
-  waypoint* lwp_tmp = waypt_new();
+  waypoint* lwp_tmp = new waypoint;
 
   /* extract the lat/lon attributes */
   if (attr.hasAttribute("lat")) {
@@ -700,7 +700,7 @@ gpx_start(const QString& el, const QXmlStreamAttributes& attr)
     break;
   case tt_cache_placer:
     if (attr.hasAttribute("id")) {
-      waypt_alloc_gc_data(wpt_tmp)->placer_id = attr.value("id").toString().toInt();
+      wpt_tmp->AllocGCData()->placer_id = attr.value("id").toString().toInt();
     }
   default:
     break;
@@ -941,20 +941,20 @@ gpx_end(const QString& el)
     wpt_tmp->notes = cdatastr;
     break;
   case tt_cache_container:
-    waypt_alloc_gc_data(wpt_tmp)->container = gs_mkcont(cdatastr);
+    wpt_tmp->AllocGCData()->container = gs_mkcont(cdatastr);
     break;
   case tt_cache_type:
-    waypt_alloc_gc_data(wpt_tmp)->type = gs_mktype(cdatastr);
+    wpt_tmp->AllocGCData()->type = gs_mktype(cdatastr);
     break;
   case tt_cache_difficulty:
     x = cdatastr.toDouble();
-    waypt_alloc_gc_data(wpt_tmp)->diff = x * 10;
+    wpt_tmp->AllocGCData()->diff = x * 10;
     break;
   case tt_cache_hint:
-   waypt_alloc_gc_data(wpt_tmp)->hint = cdatastr.trimmed();
+   wpt_tmp->AllocGCData()->hint = cdatastr.trimmed();
     break;
   case tt_cache_desc_long: {
-    geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+    geocache_data* gc_data = wpt_tmp->AllocGCData();
     gc_data->desc_long.is_html = cache_descr_is_html;
 // FIXME: Forcing a premature conversion here saves 4% on GPX read times
 // on large PQs.  Once cdatastrp becomes  real QString this is just (minimal)
@@ -964,17 +964,17 @@ gpx_end(const QString& el)
   break;
   case tt_cache_desc_short:
     {
-      geocache_data* gc_data = waypt_alloc_gc_data(wpt_tmp);
+      geocache_data* gc_data = wpt_tmp->AllocGCData();
       gc_data->desc_short.is_html = cache_descr_is_html;
       gc_data->desc_short.utfstring = cdatastr;
     }
     break;
   case tt_cache_terrain:
     x = cdatastr.toDouble();
-    waypt_alloc_gc_data(wpt_tmp)->terr = x * 10;
+    wpt_tmp->AllocGCData()->terr = x * 10;
     break;
   case tt_cache_placer:
-    waypt_alloc_gc_data(wpt_tmp)->placer = cdatastr;
+    wpt_tmp->AllocGCData()->placer = cdatastr;
     break;
   case tt_cache_log_date:
     gc_log_date = xml_parse_time(cdatastr);
@@ -987,15 +987,15 @@ gpx_end(const QString& el)
   case tt_cache_log_type:
     if ((cdatastr.compare("Found it") == 0) &&
         (0 == wpt_tmp->gc_data->last_found.toTime_t())) {
-      waypt_alloc_gc_data(wpt_tmp)->last_found = gc_log_date;
+      wpt_tmp->AllocGCData()->last_found = gc_log_date;
     }
     gc_log_date = QDateTime();
     break;
   case tt_cache_favorite_points:
-    waypt_alloc_gc_data(wpt_tmp)->favorite_points  = cdatastr.toInt();
+    wpt_tmp->AllocGCData()->favorite_points  = cdatastr.toInt();
     break;
   case tt_cache_personal_note:
-    waypt_alloc_gc_data(wpt_tmp)->personal_note  = cdatastr;
+    wpt_tmp->AllocGCData()->personal_note  = cdatastr;
     break;
 
     /*
index f98ddd1fcf65b3c8480524b41d3e446a0f734650..6f0f82f7c30fd2ed4ce31a0d17b2c12c20bacc41 100644 (file)
@@ -526,7 +526,7 @@ gtm_read(void)
 
   /* Waypoints */
   for (i = 0; i != wp_count; i++) {
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = fread_double(file_in);
     wpt->longitude = fread_double(file_in);
     convert_datum(&wpt->latitude, &wpt->longitude);
@@ -561,7 +561,7 @@ gtm_read(void)
 
   /* Tracklogs */
   for (i = 0; i != tr_count; i++) {
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = fread_double(file_in);
     wpt->longitude = fread_double(file_in);
     convert_datum(&wpt->latitude, &wpt->longitude);
@@ -595,7 +595,7 @@ gtm_read(void)
 
   /* Routes */
   for (i = 0; i != rt_count; i++) {
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = fread_double(file_in);
     wpt->longitude = fread_double(file_in);
     convert_datum(&wpt->latitude, &wpt->longitude);
index 10ba6111738c961e2404a358a795b63d3b7921d4..ac9de4626cc42de6d79c5186e795ebe0ba38bbe9 100644 (file)
@@ -493,7 +493,7 @@ gtc_trk_lap_e(xg_string unused, const QXmlStreamAttributes* unusedattrs)
 void
 gtc_trk_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 void
@@ -504,7 +504,7 @@ gtc_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused)
       /* Add the first point of an ActivityLap as
       a waypoint as well as a trackpoint. */
       char cbuf[10];
-      waypoint* wpt_lap_s = waypt_dupe(wpt_tmp);
+      waypoint* wpt_lap_s = new waypoint(*wpt_tmp);
       snprintf(cbuf, sizeof(cbuf), "LAP%03d", lap_ct);
       wpt_lap_s->shortname = cbuf;
       waypt_add(wpt_lap_s);
@@ -513,7 +513,7 @@ gtc_trk_pnt_e(xg_string args, const QXmlStreamAttributes* unused)
 
     track_add_wpt(trk_head, wpt_tmp);
   } else {
-    waypt_free(wpt_tmp);
+    delete wpt_tmp;
   }
 
   wpt_tmp = NULL;
@@ -626,7 +626,7 @@ gtc_wpt_crs_s(const QString& args, const QXmlStreamAttributes* unused)
 gtc_wpt_crs_s(const char* unused, const QXmlStreamAttributes* unusedattrs)
 #endif
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 void
@@ -635,7 +635,7 @@ gtc_wpt_crs_e(xg_string args, const QXmlStreamAttributes* unused)
   if (wpt_tmp->longitude != 0. && wpt_tmp->latitude != 0.) {
     waypt_add(wpt_tmp);
   } else {
-    waypt_free(wpt_tmp);
+    delete wpt_tmp;
   }
 
   wpt_tmp = NULL;
@@ -644,7 +644,7 @@ gtc_wpt_crs_e(xg_string args, const QXmlStreamAttributes* unused)
 void
 gtc_wpt_pnt_s(xg_string unused, const QXmlStreamAttributes* unusedattrs)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
   lap_ct++;
 }
 
@@ -657,7 +657,7 @@ gtc_wpt_pnt_e(xg_string args, const QXmlStreamAttributes* unused)
     wpt_tmp->shortname = QString().sprintf("LAP%03d", lap_ct);
     waypt_add(wpt_tmp);
   } else {
-    waypt_free(wpt_tmp);
+    delete wpt_tmp;
   }
 
   wpt_tmp = NULL;
index 99bb7bb574deaf7566c4c306f5e3be84502d82b5..f399e9ecade7f6eeb1ac15f6614f49a72fe4650a 100644 (file)
@@ -194,7 +194,7 @@ hiketech_write(void)
 static
 void    ht_wpt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 static
@@ -256,7 +256,7 @@ void        ht_trk_ident(xg_string args, const QXmlStreamAttributes* unused)
 static
 void   ht_trk_pnt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 static
index 2ba4a58627b4534d7270bf8234a97868d21b0d70..4c9a0c57d967b5ba3e58f0a772a287583d51e3f7 100644 (file)
@@ -105,7 +105,7 @@ static void data_read(void)
 
   /* Get the waypoints */
   for (iCount = 0; iCount < iWptNum ; iCount ++) {
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     iWptIndex = le_read16(&((WPTHDR*)HxWpt)->idx[iCount]);
     pWptHxTmp = (WPT*)&HxWpt[OFFS_WPT + (sizeof(WPT) * iWptIndex)];
index 08d1ebadc69835fabe0e26268f3a34dfcd9758dd..77a638eac45fa2de18d952ba4fb8b880cb01fe3d 100644 (file)
@@ -285,7 +285,7 @@ humminbird_read_wpt(gbfile* fin)
 
   /* All right! Copy the data to the gpsbabel struct... */
 
-  wpt = waypt_new();
+  wpt = new waypoint;
 
   // Could probably find a way to eliminate the alloc/copy.
   char *s = xstrndup(w.name, sizeof(w.name));
@@ -313,7 +313,7 @@ humminbird_read_wpt(gbfile* fin)
   // that describes a sub-status
   switch (w.status) {
   case 0: // Waypoint not used.  So why do we have one?
-    waypt_free(wpt);
+    delete wpt;
     break;
   case 1: // Waypoint permanent.
   case 2: // Waypoint temporary.
@@ -324,7 +324,7 @@ humminbird_read_wpt(gbfile* fin)
   case 17: // Waypoint group body.
   case 63: // Waypoint group invalid.
   default:
-    waypt_free(wpt);
+    delete wpt;
     break;
   }
 
@@ -368,7 +368,7 @@ humminbird_read_route(gbfile* fin)
           xfree(s);
           /* rte->rte_num = hrte.num + 1; only internal number */
         }
-        route_add_wpt(rte, waypt_dupe(wpt));
+        route_add_wpt(rte, new waypoint(*wpt));
       }
     }
   }
@@ -434,7 +434,7 @@ humminbird_read_track(gbfile* fin)
 
   /* We create one wpt for the info in the header */
 
-  first_wpt = waypt_new();
+  first_wpt = new waypoint;
   g_lat = gudermannian_i1924(accum_north);
   first_wpt->latitude  = geocentric_to_geodetic_hwr(g_lat);
   first_wpt->longitude = accum_east/EAST_SCALE * 180.0;
@@ -443,7 +443,7 @@ humminbird_read_track(gbfile* fin)
   track_add_wpt(trk, first_wpt);
 
   for (i=0 ; i<th.num_points-1 ; i++) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
     int16_t next_deltaeast, next_deltanorth;
     double guder;
 
@@ -554,7 +554,7 @@ humminbird_read_track_old(gbfile* fin)
 
   /* We create one wpt for the info in the header */
 
-  first_wpt = waypt_new();
+  first_wpt = new waypoint;
   g_lat = gudermannian_i1924(accum_north);
   first_wpt->latitude  = geocentric_to_geodetic_hwr(g_lat);
   first_wpt->longitude = accum_east/EAST_SCALE * 180.0;
@@ -562,7 +562,7 @@ humminbird_read_track_old(gbfile* fin)
   track_add_wpt(trk, first_wpt);
 
   for (i=0 ; i<th.num_points-1 ; i++) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
 //             int16_t next_deltaeast, next_deltanorth;
     double guder;
 
index f452c931055f0aeaf15834d2d4a52109bb0abaf6..be6762382464a07cc0010753d7e3b9011d1564c9 100644 (file)
@@ -199,7 +199,7 @@ static void igc_task_rec(const char* rec)
     fatal(MYNAME ": task waypoint (C) record parse error\n%s", rec);
   }
 
-  wpt = waypt_new();
+  wpt = new waypoint;
   wpt->latitude = ('N' == lat_hemi[0] ? 1 : -1) *
                   (lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60);
 
@@ -246,7 +246,7 @@ static void igc_task_rec(const char* rec)
 
   // Zero lat and lon indicates an unknown waypoint
   if (coords_match(wpt->latitude, wpt->longitude, 0.0, 0.0)) {
-    waypt_free(wpt);
+    delete wpt;
     return;
   }
   wpt->shortname = short_name;
@@ -350,7 +350,7 @@ static void data_read(void)
                  &validity, &pres_alt, &gnss_alt) != 14) {
         fatal(MYNAME ": fix (B) record parse error\n%s\n", ibuf);
       }
-      pres_wpt = waypt_new();
+      pres_wpt = new waypoint;
 
       pres_wpt->latitude = ('N' == lat_hemi[0] ? 1 : -1) *
                            (lat_deg + (lat_min * 1000 + lat_frac) / 1000.0 / 60);
@@ -377,7 +377,7 @@ static void data_read(void)
 
       // Add the same waypoint with GNSS altitude to the second
       // track
-      gnss_wpt = waypt_dupe(pres_wpt);
+      gnss_wpt = new waypoint(*pres_wpt);
 
       if (gnss_alt) {
         gnss_valid = 1;
index bb8c43bb6fa5dc3c491c9b872289a89a346806ea..49282db5d7dea533e5e951834dc52297be217023 100644 (file)
@@ -111,7 +111,7 @@ ignr_etape_begin(xg_string args, const QXmlStreamAttributes* attrv)
 {
   ignr_xml_error((wpt != NULL));
 
-  wpt = waypt_new();
+  wpt = new waypoint;
 }
 
 static void
index 7b7d0d83b99a5e67d108689a40ad059fab45164b..19a7700b61481a2b707952d60225643826834138 100644 (file)
@@ -161,7 +161,7 @@ static void igo8_read(void)
   while (in_point_count &&
          gbfread(&point, sizeof(point), 1, igo8_file_in) > 0) {
     in_point_count--;
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     wpt_tmp->latitude = le_read32(&point.lat) / (double)0x800000;
     wpt_tmp->longitude = le_read32(&point.lon) / (double)0x800000;
index 65a5d67e801db7b0ab3cd14e3c937b028d5592f9..e39e2aa2dfc08869449b198d79100d82e1f80146 100644 (file)
@@ -85,7 +85,7 @@ iktobj_waypt(xg_string args, const QXmlStreamAttributes* attrv)
 static void
 iktobj_trkpt(xg_string args, const QXmlStreamAttributes* attrv)
 {
-  waypt = waypt_new();
+  waypt = new waypoint;
   iktobj_waypt(args, attrv);
   track_add_wpt(track, waypt);
   waypt = NULL;
@@ -113,7 +113,7 @@ iktobj_type(xg_string args, const QXmlStreamAttributes* unused)
   switch (atoi(args)) {
 #endif
   case 0:
-    waypt = waypt_new();
+    waypt = new waypoint;
     break;
   case 1:
     track = route_head_alloc();
index a78b538bb344c40df8cb882caa8c74aa1c5e16cf..ad800238dd64bd05b15934ca7503ffd9b65e3147 100644 (file)
@@ -97,7 +97,7 @@ interpfilt_process(void)
           for (timen = time1+interval;
                timen < wpt->creation_time.toTime_t();
                timen += interval) {
-            waypoint* wpt_new = waypt_dupe(wpt);
+            waypoint* wpt_new = new waypoint(*wpt);
             wpt_new->SetCreationTime(timen);
 #if NEW_STRINGS
             wpt_new->shortname = QString();
@@ -134,7 +134,7 @@ interpfilt_process(void)
             for (distn = dist;
                  distn < curdist;
                  distn += dist) {
-              waypoint* wpt_new = waypt_dupe(wpt);
+              waypoint* wpt_new = new waypoint(*wpt);
               wpt_new->SetCreationTime(distn/curdist*
                                        (wpt->creation_time.toTime_t() - time1) + time1);
 #if NEW_STRINGS
@@ -164,9 +164,9 @@ interpfilt_process(void)
         }
       }
       if (opt_route) {
-        route_add_wpt(rte_new, waypt_dupe(wpt));
+        route_add_wpt(rte_new, new waypoint(*wpt));
       } else {
-        track_add_wpt(rte_new, waypt_dupe(wpt));
+        track_add_wpt(rte_new, new waypoint(*wpt));
       }
 
       lat1 = wpt->latitude;
index c06469610575e9a105df683efe70644f1d91c698..5d5145327281dc52ba275b4026f932284a38cba1 100644 (file)
@@ -292,7 +292,7 @@ static waypoint*
 to_waypoint(itracku_data_record* d)
 {
   waypoint* wp;
-  wp = waypt_new();
+  wp = new waypoint;
   wp->longitude = deg_min_to_deg(le_read32(d->longitude));
   wp->latitude = deg_min_to_deg(le_read32(d->latitude));
   wp->SetCreationTime(decode_itracku_time(le_read32(d->creation_time)));
@@ -710,7 +710,7 @@ gprmc_parse(char* ibuf)
   dmy = dmy / 100;
   tm.tm_mday = dmy;
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed));
 
index c3e7bfc4d5b9a5fbe71075f4108996ea1e582ad5..b8a7037826aa033cee8c4896907a747416f07884 100644 (file)
@@ -52,7 +52,7 @@ jogmap_markers(xg_string args, const QXmlStreamAttributes* attrv)
 static void
 jogmap_marker(xg_string args, const QXmlStreamAttributes* attrv)
 {
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
 
   if (attrv->hasAttribute("lat")) {
     wpt->latitude = attrv->value("lat").toString().toDouble();
index 7452669b59fa6e8726814a5a99e8cccd0402b1bc..255b64e8e52d117a4a067229b11bfea4ed0586ba 100644 (file)
@@ -213,7 +213,7 @@ jtr_read(void)
       continue;
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->latitude = lat;
     wpt->longitude = lon;
index 24850fcfe9153083d85f1555d3cddb2b0a23770f..74a5ce11ed3eccdcc1371b6fea910dcede5f6702 100644 (file)
@@ -272,7 +272,7 @@ const char* kml_tags_to_ignore[] = {
 
 void wpt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
   wpt_tmp_queued = 0;
 }
 
@@ -281,7 +281,7 @@ void wpt_e(xg_string args, const QXmlStreamAttributes* unused)
   if (wpt_tmp_queued) {
     waypt_add(wpt_tmp);
   } else {
-    waypt_free(wpt_tmp);
+    delete wpt_tmp;
   }
   wpt_tmp_queued = 0;
 }
@@ -338,7 +338,7 @@ void trk_coord(xg_string args, const QXmlStreamAttributes* attrv)
   }
   track_add_head(trk_head);
   while ((n = sscanf(CSTR(iargs), "%lf,%lf,%lf%n", &lon, &lat, &alt, &consumed)) > 0) {
-    trkpt = waypt_new();
+    trkpt = new waypoint;
     trkpt->latitude = lat;
     trkpt->longitude = lon;
 
@@ -2088,7 +2088,7 @@ kml_wr_position(waypoint* wpt)
 
     if (radtometers(gcdist(RAD(wpt->latitude), RAD(wpt->longitude),
                            RAD(newest_posn->latitude), RAD(newest_posn->longitude))) > 50) {
-      track_add_wpt(posn_trk_head, waypt_dupe(wpt));
+      track_add_wpt(posn_trk_head, new waypoint(*wpt));
     } else {
       /* If we haven't move more than our threshold, pretend
        * we didn't move at  all to prevent Earth from jittering
index 462fd744a14f6b2b04fc7e487be1f1eec9f9dda4..7c4dc30ad3e405691a2a67fde3f9e1eb55562fa3 100644 (file)
@@ -338,7 +338,7 @@ lmx_rd_deinit(void)
 static void
 lmx_lm_start(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 static void
index a566caaa44a4b5c0285cc083fe6ece8e539d1709..fc172845888b348f5b3236672ad67922de6c53f5 100644 (file)
@@ -481,7 +481,7 @@ lowranceusr_parse_routes(void)
 
     /* waypoints */
     for (j=0; j < num_legs; j++) {
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       lowranceusr_parse_waypt(wpt_tmp);
       route_add_wpt(rte_head, wpt_tmp);
     }
@@ -513,7 +513,7 @@ lowranceusr_parse_icons(void)
       (void) gbfread(&buff[0], 4, 1, file_in);
     } else {
       waypoint* wpt_tmp;
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       /* position coord lat & long */
       wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in));
@@ -594,7 +594,7 @@ lowranceusr_parse_trails(void)
         }
 
         for (j=0; j < num_section_points; j++, num_trail_points--) {
-          wpt_tmp = waypt_new();
+          wpt_tmp = new waypoint;
           wpt_tmp->latitude = lat_mm_to_deg(gbfgetint32(file_in));
           wpt_tmp->longitude = lon_mm_to_deg(gbfgetint32(file_in));
           /* continuous */
@@ -655,7 +655,7 @@ data_read(void)
   for (i = 0; i < NumWaypoints; i++) {
     waypoint* wpt_tmp;
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     /* Object num */
     object_num = gbfgetint16(file_in);
index 8761b4d5a0bcc1fd129e1cc691b33f8b4f711068..ff82f5fa1c9ac91f4bbfdddb4f10b4e03880479c 100644 (file)
@@ -359,7 +359,7 @@ lowranceusr4_parse_waypoints(void)
   for (i = 0; i < num_waypts; ++i) {
     waypoint* wpt_tmp;
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
     lowranceusr4_fsdata* fsdata = lowranceusr4_alloc_fsdata();
     fs_chain_add(&(wpt_tmp->fs), (format_specific_data*) fsdata);
 
@@ -564,7 +564,7 @@ lowranceusr4_parse_routes(void)
           printf(MYNAME " parse_routes: added wpt %s to route %s\n",
                  CSTRc(wpt_tmp->shortname), CSTRc(rte_head->rte_name));
         }
-        route_add_wpt(rte_head, waypt_dupe(wpt_tmp));
+        route_add_wpt(rte_head, new waypoint(*wpt_tmp));
       }
     }
 
@@ -683,7 +683,7 @@ lowranceusr4_parse_trails(void)
     }
 
     for (j = 0; j < num_trail_pts; ++j) {
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       /* Some unknown bytes */
       gbfgetint16(file_in);
index 0093b76f61e56a605e19016959e7f5049659ecf8..9064fa7a281f335b6addad1062fa2d3c3f87ab76 100644 (file)
@@ -101,8 +101,8 @@ maggeo_read(void)
     buff += 9; /* skip field no. 1 */
     fld = 1;
 
-    wpt_tmp = waypt_new();
-    gcdata = waypt_alloc_gc_data(wpt_tmp);
+    wpt_tmp = new waypoint;
+    gcdata = wpt_tmp->AllocGCData();
 
     while ((s = csv_lineparse(buff, ",", "", fld++))) {
       buff = NULL;
index a2e9d4f5209e6d191fc5c6044b4d1879985799b3..3fc9b76cd5e0088dfaec82fae43db5266fd55c1f 100644 (file)
@@ -974,7 +974,7 @@ mag_trkparse(char* trkmsg)
   struct tm tm;
   waypoint* waypt;
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   memset(&tm, 0, sizeof(tm));
 
@@ -1155,7 +1155,7 @@ mag_rteparse(char* rtemsg)
 #else
         if (strcmp(waypt->shortname, re->wpt_name) == 0) {
 #endif
-          waypoint* wpt = waypt_dupe(waypt);
+          waypoint* wpt = new waypoint(*waypt);
           route_add_wpt(rte_head, wpt);
           break;
         }
@@ -1235,7 +1235,7 @@ mag_wptparse(char* trkmsg)
   descr[0] = 0;
   icon_token[0] = 0;
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   sscanf(trkmsg,"$PMGNWPL,%lf,%c,%lf,%c,%d,%c,%[^,],%[^,]",
          &latdeg,&latdir,
index 7453a4dcd63b9f0f3d0b59d71589dfd05f863954..1bb72abd8ab769a489ad914b9c7838e22c281613 100644 (file)
@@ -695,7 +695,7 @@ main(int argc, char* argv[])
 
       if (tracking_status.request_terminate) {
         if (wpt) {
-          waypt_free(wpt);
+          delete wpt;
         }
         break;
       }
@@ -708,7 +708,7 @@ main(int argc, char* argv[])
           /* Just print to screen */
           waypt_disp(wpt);
         }
-        waypt_free(wpt);
+        delete wpt;
       }
     }
     if (ivecs->position_ops.rd_deinit) {
index f4259ac9d11d5dd06b73d581efaa764be29b3cb2..5166e7dc1705a2a9345cf4a3373c59fc57bbaf17 100644 (file)
@@ -110,7 +110,7 @@ tr7_read(void)
       continue;
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->latitude = lat;
     wpt->longitude = lon;
@@ -123,12 +123,12 @@ tr7_read(void)
 #if 0          /* unsure, not validated items */
     wpt->fix = buff[TR7_S_FIX];
     if (buff[TR7_S_VALID] != 'A') {
-      waypt_free(wpt);
+      delete wpt;
       continue;
     }
 #endif
     if (waypt_speed(prev, wpt) > 9999.9) {     /* filter out some bad trackpoints */
-      waypt_free(wpt);
+      delete wpt;
       continue;
     }
 
index 05f35abfdb2a64c53ea9ab5389e45de6d819bba7..aa152a310bf5df44b7d57be1a141db2a6c48ff92 100644 (file)
@@ -70,7 +70,7 @@ read_waypoint(void)
   int longitude = gbfgetint32(fin);
   int latitude = gbfgetint32(fin);
 
-  waypoint* ret = waypt_new();
+  waypoint* ret = new waypoint;
 
   ret->latitude = double(latitude)/DIV_RATE;
   ret->longitude = double(longitude)/DIV_RATE;
index 4c31035769b92c68b8688ddc80d55ff27b50009c..91623c5a0221d95df5f30e0b1904e26037e1e909 100644 (file)
@@ -121,7 +121,7 @@ mapsend_wpt_read(void)
   wpt_count = gbfgetint32(mapsend_file_in);
 
   while (wpt_count--) {
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     wpt_tmp->shortname = gbfgetpstr(mapsend_file_in);
     wpt_tmp->description = gbfgetpstr(mapsend_file_in);
@@ -162,7 +162,7 @@ mapsend_wpt_read(void)
     wpt_count = gbfgetint32(mapsend_file_in);
 
     while (wpt_count--) {
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       /* waypoint name */
       wpt_tmp->shortname = gbfgetpstr(mapsend_file_in);
@@ -202,7 +202,7 @@ mapsend_track_read(void)
   trk_count = gbfgetuint32(mapsend_file_in);
 
   while (trk_count--) {
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     wpt_tmp->longitude = gbfgetdbl(mapsend_file_in);
     wpt_tmp->latitude = -gbfgetdbl(mapsend_file_in);
index 87ae9362705b27f765b0bbfaad62b1fe48efc538..491e8f434d76f2c971333fa4f60e0e492513257a 100644 (file)
@@ -126,7 +126,7 @@ mps_wpt_q_deinit(queue* whichQueue)
 
   QUEUE_FOR_EACH(whichQueue, elem, tmp) {
     waypoint* q = (waypoint*) dequeue(elem);
-    waypt_free(q);
+    delete q;
   }
 }
 
@@ -156,7 +156,7 @@ mps_find_wpt_q_by_name(const queue* whichQueue, const QString& name)
 void
 mps_wpt_q_add(const queue* whichQueue, const waypoint* wpt)
 {
-  waypoint* written_wpt = waypt_dupe(wpt);
+  waypoint* written_wpt = new waypoint(*wpt);
   ENQUEUE_TAIL(whichQueue, &written_wpt->Q);
 }
 
@@ -527,7 +527,7 @@ mps_waypoint_r(gbfile* mps_file, int mps_ver, waypoint** wpt, unsigned int* mpsc
   double       mps_proximity = unknown_alt;
   double       mps_depth = unknown_alt;
 
-  thisWaypoint = waypt_new();
+  thisWaypoint = new waypoint;
   *wpt = thisWaypoint;
 
   mps_readstr(mps_file, wptname, sizeof(wptname));
@@ -856,7 +856,7 @@ mps_waypoint_w_uniqloc_wrapper(waypoint* wpt)
         ((wpt->longitude - wptfound->longitude) != 0)) {
       /* Not the same lat lon, so rename and add */
       newName = mkshort(written_wpt_mkshort_handle, wpt->shortname);
-      wptfound = waypt_dupe(wpt);
+      wptfound = new waypoint(*wpt);
       xfree(wptfound->shortname);
       wptfound->shortname = newName;
       mps_waypoint_w(mps_file_out, mps_ver_out, wptfound, (1==0));
@@ -1008,18 +1008,18 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte)
     tempWpt = find_waypt_by_name(wptname);
 
     if (tempWpt != NULL) {
-      thisWaypoint = waypt_dupe(tempWpt);
+      thisWaypoint = new waypoint(*tempWpt);
     } else {
       tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname);
 
       if (tempWpt != NULL) {
-        thisWaypoint = waypt_dupe(tempWpt);
+        thisWaypoint = new waypoint(*tempWpt);
       } else {
         /* should never reach here, but we do need a fallback position */
 #ifdef MPS_DEBUG
         fprintf(stderr, "mps_route_r: reached the point we never should\n");
 #endif
-        thisWaypoint = waypt_new();
+        thisWaypoint = new waypoint;
         thisWaypoint->shortname = wptname;
         thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
         thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
@@ -1095,15 +1095,15 @@ mps_route_r(gbfile* mps_file, int mps_ver, route_head** rte)
   tempWpt = find_waypt_by_name(wptname);
 
   if (tempWpt != NULL) {
-    thisWaypoint = waypt_dupe(tempWpt);
+    thisWaypoint = new waypoint(*tempWpt);
   } else {
     tempWpt = mps_find_wpt_q_by_name(&read_route_wpt_head, wptname);
 
     if (tempWpt != NULL) {
-      thisWaypoint = waypt_dupe(tempWpt);
+      thisWaypoint = new waypoint(*tempWpt);
     } else {
       /* should never reach here, but we do need a fallback position */
-      thisWaypoint = waypt_new();
+      thisWaypoint = new waypoint;
       thisWaypoint->shortname = wptname;
       thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
       thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
@@ -1553,7 +1553,7 @@ mps_track_r(gbfile* mps_file, int mps_ver, route_head** trk)
       gbfseek(mps_file, 8, SEEK_CUR);
     }
 
-    thisWaypoint = waypt_new();
+    thisWaypoint = new waypoint;
     thisWaypoint->latitude = GPS_Math_Semi_To_Deg(lat);
     thisWaypoint->longitude = GPS_Math_Semi_To_Deg(lon);
     thisWaypoint->SetCreationTime(dateTime);
@@ -1749,14 +1749,14 @@ mps_read(void)
         fprintf(stderr,"Lost sync with the file reading waypoint - %s\n", wpt->shortname);
 #endif
         gbfseek(mps_file_in, mpsFileInPos + reclen, SEEK_SET);
-        waypt_free(wpt);
+        delete wpt;
       } else {
         /* only add to the "real" list if a "user" waypoint otherwise add to the private list */
         if (mpsWptClass == MPSDEFAULTWPTCLASS) {
           waypt_add(wpt);
         } else {
           mps_wpt_q_add(&read_route_wpt_head, wpt);
-          waypt_free(wpt);
+          delete wpt;
         }
 #ifdef DUMP_ICON_TABLE
         printf("\t{  %4u, \"%s\" },\n", icon, wpt->shortname);
@@ -1905,7 +1905,7 @@ mps_write(void)
            since we're here because the user didn't request waypoints, this should be acceptable */
         mps_waypoint_r(mps_file_temp, mps_ver_temp, &wpt, &mpsWptClass);
         mps_wpt_q_add(&written_wpt_head, wpt);
-        waypt_free(wpt);
+        delete wpt;
         /* now return to the start of the waypoint data to do a "clean" copy */
         gbfseek(mps_file_temp, tempFilePos, SEEK_SET);
 
@@ -1941,7 +1941,7 @@ mps_write(void)
           if (mpsWptClass == MPSDEFAULTWPTCLASS) {
             waypt_add(wpt);
           } else {
-            waypt_free(wpt);
+            delete wpt;
           }
         } else {
           break;
index b886905ff5b9fb19494cd31733af714a92516dbb..4a0eb4ce6e12b68412e0acb62860de26680a41ed 100644 (file)
@@ -324,7 +324,7 @@ mmo_get_waypt(mmo_data_t* data)
   if (data->refct == 1) {
     return (waypoint*)data->data;
   } else {
-    return waypt_dupe((waypoint*)data->data);
+    return new waypoint(*(waypoint*)data->data);
   }
 }
 
@@ -335,7 +335,7 @@ mmo_free_object(mmo_data_t* data)
     xfree(data->name);
   }
   if ((data->type == wptdata) && (data->refct == 0)) {
-    waypt_free((waypoint*)data->data);
+    delete (waypoint*)data->data;
   }
   xfree(data);
 }
@@ -460,7 +460,7 @@ mmo_read_CObjWaypoint(mmo_data_t* data)
   DBG((sobj, "name = \"%s\" [ visible=%s, id=0x%04X ]\n",
        data->name, data->visible ? "yes" : "NO", data->objid));
 
-  data->data = wpt = waypt_new();
+  data->data = wpt = new waypoint;
   wpt->shortname = QString::fromLatin1(data->name);
 
   time = data->mtime;
@@ -635,7 +635,7 @@ mmo_read_CObjRoute(mmo_data_t* data)
       /* FIXME: At this point this waypoint maybe not fully loaded (initialized) !!!
          We need a final procedure to handle this !!! */
       if (! tmp->loaded) {
-        wpt = waypt_new();
+        wpt = new waypoint;
         wpt->latitude = 0;
         wpt->longitude = 0;
         xasprintf(&wpt->shortname, "\01%p", tmp);
@@ -690,7 +690,7 @@ mmo_read_CObjTrack(mmo_data_t* data)
     waypoint* wpt;
     char unk;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     wpt->latitude = gbfgetdbl(fin);
     wpt->longitude = gbfgetdbl(fin);
index e977538a2828a7be7f0e9faa4ecc7d6a2c0e1b89..a04ec73db7184c7bebac3f061954e9a23dd0fce3 100644 (file)
@@ -436,7 +436,7 @@ process_pmtklox()
     }
 
     if (global_opts.masked_objective & TRKDATAMASK) {
-      trkpt  = waypt_new();
+      trkpt  = new waypoint;
       trkpt->SetCreationTime(timestamp);
       trkpt->latitude = latitude;
       trkpt->longitude = longitude;
@@ -448,7 +448,7 @@ process_pmtklox()
     }
 
     if (global_opts.masked_objective & WPTDATAMASK) {
-      waypt  = waypt_new();
+      waypt  = new waypoint;
       waypt->SetCreationTime(timestamp);
       waypt->latitude = latitude;
       waypt->longitude = longitude;
index 748144e4d0e523138434b9fb696c395c256cf207..a70713b49ddf707bd9c15605d97b698d12f37053 100644 (file)
@@ -747,7 +747,7 @@ mtk_retry:
 static route_head*  trk_head = NULL;
 static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
 {
-  waypoint* trk = waypt_new();
+  waypoint* trk = new waypoint;
 
   if (global_opts.masked_objective& TRKDATAMASK && (trk_head == NULL || (mtk_info.track_event & MTK_EVT_START))) {
     char spds[50];
@@ -826,7 +826,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
      */
     if ((trk->fix == fix_unknown || trk->fix == fix_none)  &&
         trk->latitude - 90.0 < .000001 && trk->longitude < 0.000001) {
-      waypt_free(trk);
+      delete trk;
       return -1;
     }
   }
@@ -842,7 +842,7 @@ static int add_trackpoint(int idx, unsigned long bmask, struct data_item* itm)
          )
      ) {
     /* Button press -- create waypoint, start count at 1 */
-    waypoint* w = waypt_dupe(trk);
+    waypoint* w = new waypoint(*trk);
 
     w->shortname = QString().sprintf("WP%06d", waypt_count()+1);
     waypt_add(w);
index 9f9ecc62f85efa4daf4cd9ca8d4477003f9f4c37..61a32756961430dc52b5b07200a8a04b4c98f1e9 100644 (file)
@@ -100,9 +100,9 @@ static void
 NaviReadCache(const QXmlStreamReader& reader)
 {
   const QXmlStreamAttributes a = reader.attributes();
-  waypoint* wpt_tmp = waypt_new();
+  waypoint* wpt_tmp = new waypoint;
   geocache_data* gc_data;
-  gc_data = waypt_alloc_gc_data(wpt_tmp);
+  gc_data = wpt_tmp->AllocGCData();
   if (a.hasAttribute("cache_id")) {
     int n = a.value("cache_id").toString().toInt();
     QString fn = QString("N%1").arg(n, 5, 16, QChar('0'));
@@ -154,7 +154,7 @@ NaviReadCache(const QXmlStreamReader& reader)
 
   if (a.hasAttribute("retired")) {
     if (a.value("terrain").toString() == "yes" && noretired) {
-      waypt_free(wpt_tmp);
+      delete wpt_tmp;
       return;
     }
   }
index ca89cb8dbd4795e20b720040973febbcb426a523..7352f17517003eb0f4647fe24d074693e19e4297 100644 (file)
@@ -383,7 +383,7 @@ data_read(void)
 
   for (int n = 0; n < nof_wp; ++n) {
 
-    waypoint* wpt_tmp = waypt_new();
+    waypoint* wpt_tmp = new waypoint;
 
     /* Read waypoint data */
 
index 48b961d0058142e04fe364ac853a08bd1df5a5e5..34497ddf689ff1fc15f5342d4742193e0ba26432 100644 (file)
@@ -194,7 +194,7 @@ free_waypoints(waypoint** waypts)
 
   for (wayptp = waypts; wayptp < waypts + MAX_WAYPOINTS; wayptp++) {
     if (*wayptp) {
-      waypt_free(*wayptp);
+      delete *wayptp;
     }
   }
 
@@ -410,7 +410,7 @@ decode_waypoint_id(const unsigned char* buffer)
 static waypoint*
 decode_waypoint(const unsigned char* buffer)
 {
-  waypoint* waypt = waypt_new();
+  waypoint* waypt = new waypoint;
 
   decode_position(buffer + 12, waypt);
   char* s = xstrdup((char*)buffer + 4);
@@ -442,7 +442,7 @@ encode_waypoint(const waypoint* waypt, unsigned char* buffer)
 static waypoint*
 decode_trackpoint(const unsigned char* buffer)
 {
-  waypoint* waypt = waypt_new();
+  waypoint* waypt = new waypoint;
 
   decode_position(buffer + 12, waypt);
   waypt->SetCreationTime(decode_datetime(buffer + 22));
@@ -704,7 +704,7 @@ serial_read_routes(waypoint** waypts)
         } else if (waypts[id] == NULL) {
           fatal(MYNAME ": Non-existent waypoint in route\n");
         } else {
-          route_add_wpt(route, waypt_dupe(waypts[id]));
+          route_add_wpt(route, new waypoint(*waypts[id]));
         }
       }
     }
@@ -731,7 +731,7 @@ serial_write_route_point(const waypoint* waypt)
 
   if (w == MAX_WAYPOINTS) {
     w = serial_write_waypoint_packet(waypt);
-    route_waypts[w] = waypt_dupe(waypt);
+    route_waypts[w] = new waypoint(*waypt);
   }
 
   route_ids[route_id_ptr++] = w;
@@ -850,7 +850,7 @@ waypoint*
 navilink_decode_logpoint(const unsigned char* buffer)
 {
   waypoint* waypt = NULL;
-  waypt = waypt_new();
+  waypt = new waypoint;
 
   waypt->hdop = ((unsigned char)buffer[0]) * 0.2f;
   waypt->sat = buffer[1];
index 7407a3e2795e8b03c27fff12eb8d97a9c55ab40f..80e03a79fd4177a44ed6335b0a5594fec8b2ea93 100644 (file)
@@ -62,7 +62,7 @@ navitel_read_track(void)
     lon = gbfgetint32(fin);
     lat = gbfgetint32(fin);
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = GPS_Math_Semi_To_Deg(lat & 0x7FFFFFFF);
     wpt->longitude = GPS_Math_Semi_To_Deg(lon);
 
index d9e43deed1216da8824e728af2c3ab82bfcadc6e..5c07feccc51c683fba90ba4b85abcdcdbebf2921 100644 (file)
@@ -209,7 +209,7 @@ data_read(void)
       continue;
     }
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     if (stealth) {
       if (!snmac) {
index 0ed98b044fed06b44d4b9ae08b329310ef0f9dab..588e38553cc6c4ca719be5266c2f01e2355d5b9a 100644 (file)
@@ -251,7 +251,7 @@ nmea_release_wpt(waypoint* wpt)
     /* This waypoint isn't queued.
        Release it, because we don't have any reference to this
        waypoint (! memory leak !) */
-    waypt_free(wpt);
+    delete wpt;
   }
 }
 
@@ -405,7 +405,7 @@ gpgll_parse(char* ibuf)
   hms = hms / 100;
   tm.tm_hour = hms % 100;
 
-  waypt = waypt_new();
+  waypt = new waypoint;
 
   nmea_set_waypoint_time(waypt, &tm, fsec);
 
@@ -466,7 +466,7 @@ gpgga_parse(char* ibuf)
   hms = hms / 100;
   tm.tm_hour = (long) hms % 100;
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   nmea_set_waypoint_time(waypt, &tm, fsec);
 
@@ -581,13 +581,13 @@ gprmc_parse(char* ibuf)
     }
     /* This point is both a waypoint and a trackpoint. */
     if (amod_waypoint) {
-      waypt_add(waypt_dupe(curr_waypt));
+      waypt_add(new waypoint(*curr_waypt));
       amod_waypoint = 0;
     }
     return;
   }
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   WAYPT_SET(waypt, speed, KNOTS_TO_MPS(speed));
 
@@ -610,7 +610,7 @@ gprmc_parse(char* ibuf)
 
   /* This point is both a waypoint and a trackpoint. */
   if (amod_waypoint) {
-    waypt_add(waypt_dupe(waypt));
+    waypt_add(new waypoint(*waypt));
     amod_waypoint = 0;
   }
 }
@@ -628,7 +628,7 @@ gpwpl_parse(char* ibuf)
          &lngdeg,&lngdir,
          sname);
 
-  waypt  = waypt_new();
+  waypt  = new waypoint;
 
   if (latdir == 'S') {
     latdeg = -latdeg;
@@ -800,7 +800,7 @@ pcmpt_parse(char* ibuf)
   }
 
   if (lat || lon) {
-    curr_waypt = waypt_new();
+    curr_waypt = new waypoint;
     curr_waypt->longitude = pcmpt_deg(lon);
     curr_waypt->latitude = pcmpt_deg(lat);
 
index ff70b316b984e0a9f6b6d04c59f06b633df30314..0d8afc53c841f5b52e20227d203b2c5e9e66118f 100644 (file)
@@ -123,7 +123,7 @@ nmn4_read_data(void)
     /* for a quiet compiler */
     zip1 = zip2 = city = street = number = QString();
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     column = -1;
     c = csv_lineparse(str, "|", "", column++);
index 1018af9801ba301aba9e99a32778ce4e60b03eba..b7c1618811326fb5c2bbecd9ea8304d43d7dc402 100644 (file)
@@ -472,7 +472,7 @@ osm_node_end(xg_string args, const QXmlStreamAttributes* unused)
     if (wpt->wpt_flags.fmt_use) {
       waypt_add(wpt);
     } else {
-      waypt_free(wpt);
+      delete wpt;
     }
     wpt = NULL;
   }
@@ -482,7 +482,7 @@ osm_node_end(xg_string args, const QXmlStreamAttributes* unused)
 static void
 osm_node(xg_string args, const QXmlStreamAttributes* attrv)
 {
-  wpt = waypt_new();
+  wpt = new waypoint;
 
   if (attrv->hasAttribute("id")) {
     QString atstr = attrv->value("id").toString();
@@ -597,7 +597,7 @@ osm_way_nd(xg_string args, const QXmlStreamAttributes* attrv)
 
     if (waypoints.contains(atstr)) {
       ctmp = waypoints.value(atstr);
-      tmp = waypt_dupe(ctmp);
+      tmp = new waypoint(*ctmp);
       route_add_wpt(rte, tmp);
     } else {
       warning(MYNAME ": Way reference id \"%s\" wasn't listed under nodes!\n", CSTR(atstr));
index ae19f5b7eb2c29e85a58a4b9732633d1d94ba283..4a70116d2853c202ad311ccc801a59f6a7016804 100644 (file)
@@ -362,7 +362,7 @@ static void ovl_read(void)
             switch (aktTyp) {
 #ifdef WITH_BITMAP
             case 1: // Bitmap
-              wpt = waypt_new();
+              wpt = new waypoint;
               wpt->latitude = aktY;
               wpt->longitude = aktX;
               wpt->altitude = 0.0;
@@ -374,7 +374,7 @@ static void ovl_read(void)
               isSection = SECTION_SYMBOL;
               break;
             case 3: // Linie
-              wpt = waypt_new();
+              wpt = new waypoint;
               wpt->latitude = aktY;
               wpt->longitude = aktX;
               wpt->altitude = 0.0;
index 7ee7136be094c08eb8cf70acfe655b7a7fe9ee73..a95bc602a15e67a0bb296af4f69d0c33e351f106 100644 (file)
@@ -779,7 +779,7 @@ data_read(void)
     if (buff.contains(',')) {
       bool ozi_fsdata_used = false;
       ozi_fsdata* fsdata = ozi_alloc_fsdata();
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       /* data delimited by commas, possibly enclosed in quotes.  */
       char* orig_s = xstrdup(CSTR(buff));
@@ -820,7 +820,7 @@ data_read(void)
           ozi_convert_datum(wpt_tmp);
           track_add_wpt(trk_head, wpt_tmp);
         } else {
-          waypt_free(wpt_tmp);
+          delete wpt_tmp;
         }
         break;
       case rtedata:
@@ -829,10 +829,10 @@ data_read(void)
           if (!header) {
             route_add_wpt(rte_head, wpt_tmp);
           } else {
-            waypt_free(wpt_tmp);
+            delete wpt_tmp;
           }
         } else {
-          waypt_free(wpt_tmp);
+          delete wpt_tmp;
         }
         break;
       case wptdata:
@@ -844,7 +844,7 @@ data_read(void)
           ozi_convert_datum(wpt_tmp);
           waypt_add(wpt_tmp);
         } else {
-          waypt_free(wpt_tmp);
+          delete wpt_tmp;
         }
         break;
       case posndata:
index 8a72fc8c89dd07c255f73af8a910e457c16a3eeb..5f9de4aac8ff6d420ec429b632055017b541b624 100644 (file)
@@ -153,7 +153,7 @@ data_read(void)
       name[sizeof(name)-1] = '\0';
       desc[sizeof(desc)-1] = '\0';
 
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       wpt_tmp->altitude = alt;
       cp = lrtrim(name);
       if (*cp != '\0') {
@@ -184,7 +184,7 @@ data_read(void)
         wpt_tmp->latitude = ddmm2degrees(lat);
       }
       if (route != NULL) {
-        route_add_wpt(route, waypt_dupe(wpt_tmp));
+        route_add_wpt(route, new waypoint(*wpt_tmp));
       }
       waypt_add(wpt_tmp);
       points++;
@@ -253,7 +253,7 @@ data_read(void)
       if (tm.tm_year < 70) {
         tm.tm_year += 100;
       }
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       wpt_tmp->SetCreationTime(mkgmtime(&tm));
       if (read_as_degrees) {
         wpt_tmp->longitude = lon;
index fc1d4bcf99bcaee3eb9571decd69f51eb62c8a21..aeaf9ee54f6dcc388276f8a5b39748a77471f308 100644 (file)
@@ -104,7 +104,7 @@ read_tracks(void)
     tm.tm_min = le_readu16(&bc.minute);
     tm.tm_sec = le_readu16(&bc.second);
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = le_read_float(&bc.latitude);
     wpt->longitude = le_read_float(&bc.longitude);
     wpt->altitude = FEET_TO_METERS(le_read_float(&bc.altitude));
index 83d0bc5b121f3226881746246eaf38fd0e765471..f5eff59b56b06bc9a0c1f4df455cb5970872cd98 100644 (file)
@@ -88,12 +88,12 @@ wr_init(const char* fname)
 void   wpt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
   if (isFirst == 1) {
-    wpt_from = waypt_new();
+    wpt_from = new waypoint;
     route = route_head_alloc();
     route->rte_desc="PocketFMS flightplan";
     route_add_head(route);
   }
-  wpt_to = waypt_new();
+  wpt_to = new waypoint;
 }
 
 void   wpt_e(xg_string args, const QXmlStreamAttributes* unused)
@@ -101,14 +101,14 @@ void      wpt_e(xg_string args, const QXmlStreamAttributes* unused)
   if (isFirst == 1) {
     route_add_wpt(route, wpt_from);
     if (doing_wpts) {
-      waypt_add(waypt_dupe(wpt_from));
+      waypt_add(new waypoint(*wpt_from));
     }
     wpt_from = NULL;
     isFirst = 0;
   }
   route_add_wpt(route, wpt_to);
   if (doing_wpts) {
-    waypt_add(waypt_dupe(wpt_to));
+    waypt_add(new waypoint(*wpt_to));
   }
   wpt_to = NULL;
 }
index 2521f9220e2c40088742535126755533d3e8cc6d..656fe6ee6db1583e8e5b3706fcb7441e407903b2 100644 (file)
@@ -65,7 +65,7 @@ data_read(void)
       break;
     }
     linecount++;
-    wpt = waypt_new();
+    wpt = new waypoint;
     s = buff;
     s = csv_lineparse(s, "\\w", "", linecount);
     if (!s) {
index b6a334a538148df53d346cfdbab43063ae141d67..c926ad14c9cf47ec6ff4ec199b70b5d3293aefa0 100644 (file)
@@ -332,7 +332,7 @@ polygon_process(void)
       }
       if (((ed->state & INSIDE) == OUTSIDE) == (exclopt == NULL)) {
         waypt_del(wp);
-        waypt_free(wp);
+        delete wp;
       }
       xfree(ed);
     }
index 51267b8ceb6ec8f34bb23b21061af9abc780960f..28abf77f24e7c0c72322cf410877e5eef5b44cd2 100644 (file)
@@ -115,7 +115,7 @@ position_runqueue(queue* q, int nelems, int qtype)
             switch (qtype) {
             case wptdata:
               waypt_del(comp[j]);
-              waypt_free(comp[j]);
+              delete comp[j];
               break;
             case trkdata:
               track_del_wpt(cur_rte, comp[j]);
@@ -145,7 +145,7 @@ position_runqueue(queue* q, int nelems, int qtype)
         default:
           break;
         }
-        waypt_free(comp[i]);
+        delete comp[i];
       }
     }
   }
index bc5fdacb3f80fc8221169272d4c9833d1848a8e2..ce52ffdcd00ab34732a4b8ab1090afa1a70cd92c 100644 (file)
@@ -301,7 +301,7 @@ psit_waypoint_r(gbfile* psit_file, waypoint** wpt)
   waypoint*    thisWaypoint;
 
   if (strlen(psit_current_token) > 0) {
-    thisWaypoint = waypt_new();
+    thisWaypoint = new waypoint;
 
     thisWaypoint->latitude = atof(psit_current_token);
 
@@ -423,7 +423,7 @@ psit_route_r(gbfile* psit_file, route_head** rte)
 
   while (psit_isKnownToken(psit_current_token) != 0) {
     if (strlen(psit_current_token) > 0) {
-      thisWaypoint = waypt_new();
+      thisWaypoint = new waypoint;
 
       thisWaypoint->latitude = atof(psit_current_token);
 
@@ -568,7 +568,7 @@ psit_track_r(gbfile* psit_file, route_head** trk)
 
   while (psit_isKnownToken(psit_current_token) != 0) {
     if (strlen(psit_current_token) > 0) {
-      thisWaypoint = waypt_new();
+      thisWaypoint = new waypoint;
 
       thisWaypoint->latitude = atof(psit_current_token);
 
index 9bfa1b8b40f071497979963a2d87344529cdc29f..34b5c944633a385d5d53bcd6873229414722125a 100644 (file)
@@ -132,7 +132,7 @@ radius_process(void)
 
     if ((dist >= pos_dist) == (exclopt == NULL)) {
       waypt_del(waypointp);
-      waypt_free(waypointp);
+      delete waypointp;
       continue;
     }
 
index da85120b516c3b8b74d57ddbf835b23c2e3a2556..9c1ef3c01b2e1088e0b53c66fcde473074af5bab 100644 (file)
@@ -145,7 +145,7 @@ random_read(void)
     waypoint* wpt;
     garmin_fs_t* gmsd;
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     gmsd = garmin_fs_alloc(-1);
     fs_chain_add(&wpt->fs, (format_specific_data*) gmsd);
 
index b3a1fa6e5a63dd9c0f42f22da283db1705d1f890..16b212535b8c492984ee201e0e3ed8edbeb9e482 100644 (file)
@@ -207,7 +207,7 @@ raymarine_read(void)
       break;
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->shortname = name;
     wpt->latitude = atof(lat);
     wpt->longitude = atof(lon);
@@ -263,7 +263,7 @@ raymarine_read(void)
         fatal(MYNAME ": No associated waypoint for route point %s (Route %s)!\n",
               str, CSTRc(rte->rte_name));
 
-      route_add_wpt(rte, waypt_dupe(wpt));
+      route_add_wpt(rte, new waypoint(*wpt));
     }
   }
 }
index ec348e589b7a3e124b6147bf08a3f793fb34a90b..ac2eba0d40e0ecfcc5b68e01caf6dd1fc25b38cd 100644 (file)
@@ -422,7 +422,7 @@ route_copy(int* dst_count, int* dst_wpt_count, queue** dst, queue* src)
     rte_new->rte_num = rte_old->rte_num;
     any_route_add_head(rte_new, *dst);
     QUEUE_FOR_EACH(&rte_old->waypoint_list, elem2, tmp2) {
-      any_route_add_wpt(rte_new, waypt_dupe((waypoint*)elem2), dst_wpt_count, 0, RPT, 3);
+      any_route_add_wpt(rte_new, new waypoint(*(waypoint*)elem2), dst_wpt_count, 0, RPT, 3);
     }
     (*dst_count)++;
   }
index ae628f5215a232f385f7e094664bfde6559bb8c4..868689d1a2c3bd176d012c0cdbd1e8f25ca56a4a 100644 (file)
@@ -205,7 +205,7 @@ my_read(void)
       lon = (0x80000000UL -
              le_read32(&latlon->lat)) / (double)(0x800000);
 
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       wpt_tmp->latitude = lat;
       wpt_tmp->longitude = -lon;
       if (control) {
@@ -363,7 +363,7 @@ my_read(void)
         double lat;
         double lon;
 
-        wpt_tmp = waypt_new();
+        wpt_tmp = new waypoint;
 
         lat = (0x80000000UL -
                le_read32(&latlon->lat)) /
@@ -425,10 +425,10 @@ my_read(void)
           if (old_track_head) {
             if (timesynth) {
               track_add_wpt(old_track_head,
-                            waypt_dupe(wpt_tmp));
+                            new waypoint(*wpt_tmp));
             } else {
               route_add_wpt(old_track_head,
-                            waypt_dupe(wpt_tmp));
+                            new waypoint(*wpt_tmp));
             }
             old_track_head = NULL;
           }
index d9aba596a407f1ee31293c0876183a713bea3d49..df51d28b2f4861babaed618f35225f4bbc5271a1 100644 (file)
@@ -240,7 +240,7 @@ static waypoint*
 decode_sbn_record(unsigned char* buffer)
 {
   waypoint* waypt = NULL;
-  waypt = waypt_new();
+  waypt = new waypoint;
 
   if (is_sbn_valid(buffer)) {
     waypt->fix = decode_sbn_mode(buffer + 3);
index 91d20ddca4a46a87589613b6aabd74ac252ac946..87ea24ac8765192da710c24ee09ce5a69c2cff22 100644 (file)
@@ -172,7 +172,7 @@ my_read(void)
       routehead->rte_name = name;
       route_add_head(routehead);
       for (j = 0; j < shp->nVertices; j++) {
-        wpt = waypt_new();
+        wpt = new waypoint;
         wpt->latitude = shp->padfY[j];
         wpt->longitude = shp->padfX[j];
         wpt->altitude = shp->padfZ[j];
@@ -182,7 +182,7 @@ my_read(void)
     break;
 
     case SHPT_POINT:
-      wpt = waypt_new();
+      wpt = new waypoint;
       wpt->latitude = shp->dfYMin;
       wpt->longitude = shp->dfXMin;
       wpt->shortname = name;
index 1ac4a039a012e875581e3792ce60686733889bef..2485dbc61a3d484a1e7c48e65b2c0b571d0fd720 100644 (file)
@@ -50,7 +50,7 @@ skyforce_parse_coords(const char* str)
     fatal(MYNAME ": Incomplete line!\n");
   }
 
-  wpt = waypt_new();
+  wpt = new waypoint;
 
   wpt->latitude = atof(str + 21);
   if (str[20] == 'S') {
index 4aff7291b763c4ccb044f45e83d22a72b8bfa333..dfdc6bff03a67f2f41211802be44ac7432168980 100644 (file)
@@ -661,7 +661,7 @@ state_init(struct read_state* pst)
 static waypoint*
 make_trackpoint(struct read_state* st, double lat, double lon, double alt)
 {
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
 
   xasprintf(&wpt->shortname, "TP%04d", ++st->tpn);
 
@@ -858,7 +858,7 @@ process_data_item(struct read_state* pst, const item_frame* pitem, int len)
     WAYPT_SET(tpt, speed, KPH_TO_MPS(ITEM_SPEED(pitem))); /* convert speed to m/s */
 
     if (poi) {
-      waypt_add(waypt_dupe(tpt));
+      waypt_add(new waypoint(*tpt));
     }
 
     if (0 == pst->route_head_) {
@@ -1527,7 +1527,7 @@ static void miniHomer_get_poi()
     } else {
       ECEF_to_LLA(ecef_x, ecef_y, ecef_z, &lat, &lng, &alt);
 
-      wpt = waypt_new();
+      wpt = new waypoint;
       xasprintf(&wpt->shortname, "POI_%s", poinames[poi]);
       xasprintf(&wpt->description, "miniHomer points to this coordinates if the %s symbol is on", poinames[poi]);
       wpt->latitude       = lat;
index 4ade182641a59f19f30adb97d2f5900711c396e2..520059fd651496ff4aca5e1fcf657112477a4905 100644 (file)
@@ -337,7 +337,7 @@ routesimple_tail(const route_head* rte)
     }
     (*waypt_del_fnp)((route_head*)(void*)rte,
                      (waypoint*)(void*)(xte_recs[i].intermed->wpt));
-    waypt_free((waypoint*)(void*)(xte_recs[i].intermed->wpt));
+    delete (waypoint*)(void*)(xte_recs[i].intermed->wpt);
 
     if (xte_recs[i].intermed->prev) {
       xte_recs[i].intermed->prev->next = xte_recs[i].intermed->next;
index 11a66e9ee551fee8c2061becd6ab5971c91ea668..4e2c61faeb53cb17771fedd80c3a54253551a14b 100644 (file)
@@ -109,7 +109,7 @@ stackfilt_process(void)
     stack = tmp_elt;
     if (opt_copy) {
       QUEUE_FOR_EACH(&(stack->waypts), elem, tmp) {
-        waypt_add(waypt_dupe((waypoint*)elem));
+        waypt_add(new waypoint(*(waypoint*)elem));
       }
     }
 
index b4a577fdbfa5f19190480cd5f5824ea082db8d3f..cc88b77c5f91aebbfbf8b861a1922ae767e4181f 100644 (file)
@@ -264,7 +264,7 @@ parse_point(char* line)
         warning(MYNAME ": Unknown point type %s at line %d!\n", str, lineno);
         return;
       }
-      wpt = waypt_new();
+      wpt = new waypoint;
       break;
 
     case 1:
index 96ebe278238dc7802920ff0f25ccb56bc25a9151..4b0fce94024d22f785e1327f5bc71ff77ba5ae17 100644 (file)
@@ -125,7 +125,7 @@ stmwpp_data_read(void)
         }
 
         what = new_what;
-        wpt = waypt_new();
+        wpt = new waypoint;
         break;
 
       case 1:
@@ -175,7 +175,7 @@ stmwpp_data_read(void)
             route = route_head_alloc();
             route_add_head(route);
           }
-          route_add_wpt(route, waypt_dupe(wpt));
+          route_add_wpt(route, new waypoint(*wpt));
         }
         break;
 
index 520307309bcb9823152aca0d84621f6c9f67f308..bd8df79337aca0e70066a1dfa8b1a1e5d0dad20f 100644 (file)
@@ -211,13 +211,13 @@ waypoint_final()
 
   if (route != NULL) {
     if ((via != 0) || (routevia == NULL)) {
-      waypoint* wpt = waypt_dupe(wpt_tmp);
+      waypoint* wpt = new waypoint(*wpt_tmp);
       route_add_wpt(route, wpt);
     }
   }
 
   if (via == 0) {
-    waypt_free(wpt_tmp);
+    delete wpt_tmp;
   }
 
   wpt_tmp = NULL;
@@ -243,7 +243,7 @@ tef_item_start(xg_string args, const QXmlStreamAttributes* attrv)
 {
   waypoints++;
 
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
   if ((waypoints == 1) || (waypoints == item_count)) {
     wpt_tmp->wpt_flags.fmt_use ++;
   }
index 3ff3133b0ed306da8704f4340c4414c104ce837c..a2eb412c5dc4700a42e3f5208e0e3479d6307695 100644 (file)
@@ -59,7 +59,7 @@ teletype_read(void)
 {
   uint32_t i;
   for (i = 0; i < tty_wpt_count; i++) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
     wpt->shortname = (gbfgetcstr(fin));
     wpt->description = (gbfgetcstr(fin));
 
index 7475ab3539d2da080baef98f31eab7b1343f5dc1..77a0e067a2b3a3d42061ff673fb49e7addc35468 100644 (file)
@@ -166,7 +166,7 @@ data_read(void)
     }
     if (sscanf(ibuf, "%lf,%lf:%100[^:]:%100[^\n]",
                &lon, &lat, icon, desc)) {
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       wpt_tmp->longitude = lon;
       wpt_tmp->latitude = lat;
index 5684e8fc95b3b3b32187f669f53d8371f66eda65..a09a36d461cd30de82389d16989dbcdeff8e4bb2 100644 (file)
@@ -82,7 +82,7 @@ data_read(void)
     /* skip the line if it contains "sHyperLink" as it is a header (I hope :) */
     if ((strlen(buff)) && (strstr(buff, "sHyperLink") == NULL)) {
 
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       /* data delimited by tabs, not enclosed in quotes.  */
       s = buff;
@@ -154,7 +154,7 @@ data_read(void)
       }
 
       if (i != 11) {
-        waypt_free(wpt_tmp);
+        delete wpt_tmp;
         warning(MYNAME ": WARNING - extracted %d fields from line %d. \nData on line ignored.\n",
                 i, linecount);
       } else {
index 36e5a5fd3f49dcfaaea1adcdae6e9799da2323ed..9eb72146b4843acc3468cc1de51242f98176b5d7 100644 (file)
@@ -191,7 +191,7 @@ data_read(void)
       desc = (char*)xmalloc(recsize - 13);
       gbfread(desc, recsize-13, 1, file_in);
 
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
 
       wpt_tmp->longitude = x/100000.0;
       wpt_tmp->latitude = y/100000.0;
@@ -212,7 +212,7 @@ data_read(void)
 #if 0 // Fallthrough for now to silently ignore these until this is done.
       recsize = read_char(file_in) ;
       check_recsize(recsize);
-      wpt_tmp = waypt_new();
+      wpt_tmp = new waypoint;
       decode_latlon(&wpt_tmp->latitude, &wpt_tmp->longitude);
       gbfread(tbuf, 3, 1, file_in);
       gbfread(tbuf, 3, 1, file_in);
index 8d8c4d0ff1016b42eefa76988b76020d000ff111..e56bc40a18c269d9303df534a6abf19ffda97012 100644 (file)
@@ -119,7 +119,7 @@ tpg_read(void)
 
 
   while (pointcount--) {
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     /* pascal-like shortname */
     wpt_tmp->shortname = gbfgetpstr(tpg_file_in);
index 2b382800129c4de2976ce04e28a7ce06625b20ac..0d4fef280a84c2bfef03b5b854bae7ee24f71a7b 100644 (file)
@@ -342,7 +342,7 @@ void tpo_read_2_x(void)
     /* multiply all the deltas by the scaling factors to determine the waypoint positions */
     for (j=0; j<waypoint_count; j++) {
 
-      waypoint_temp = waypt_new();
+      waypoint_temp = new waypoint;
 
       /* convert incoming NAD27/CONUS coordinates to WGS84 */
       GPS_Math_Known_Datum_To_WGS84_M(
@@ -462,7 +462,7 @@ waypoint* tpo_convert_ll(int lat, int lon)
   waypoint* waypoint_temp;
 
 
-  waypoint_temp = waypt_new();
+  waypoint_temp = new waypoint;
 
   latitude = (double)lat / 0x800000;
   longitude = (double)lon / 0x800000;
@@ -916,7 +916,7 @@ void tpo_process_waypoints(void)
 
     // For routes (later), we need a duplicate of each waypoint
     // indexed by the order we read them in.
-    waypoint_temp2 = waypt_dupe(waypoint_temp);
+    waypoint_temp2 = new waypoint(*waypoint_temp);
 
     // Attach the copy to our index
     tpo_wp_index[tpo_index_ptr++] = waypoint_temp2;
@@ -1316,7 +1316,7 @@ void tpo_process_routes(void)
 //printf("val: %x\t\t", val);
 
       // Duplicate a waypoint from our index of waypoints.
-      waypoint_temp = waypt_dupe(tpo_wp_index[val-1]);
+      waypoint_temp = new waypoint(*tpo_wp_index[val-1]);
 
       // Add the waypoint to the route
       route_add_wpt(route_temp, waypoint_temp);
@@ -1438,7 +1438,7 @@ tpo_rd_deinit(void)
 
   // Free the waypoint index, we don't need it anymore.
   for (i = 0; i < tpo_index_ptr; i++) {
-    waypt_free(tpo_wp_index[i]);
+    delete tpo_wp_index[i];
   }
   tpo_index_ptr = 0;
 
index 9f1d35a30dca9ee3eb1aa0a51e84da7d7772d225..3b11acb5de5cfbd3220642912b6d60b3ada8a8b8 100644 (file)
@@ -338,7 +338,7 @@ trackfilter_fill_track_list_cb(const route_head* track)     /* callback for track_d
       QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) {
         waypoint* wpt = (waypoint*)elem;
         track_del_wpt((route_head*)track, wpt);
-        waypt_free(wpt);
+        delete wpt;
       }
       track_del_head((route_head*)track);
       return;
@@ -520,10 +520,10 @@ trackfilter_merge(void)
     QUEUE_FOR_EACH((queue*)&track->waypoint_list, elem, tmp) {
       wpt = (waypoint*)elem;
       if (wpt->creation_time.isValid()) {
-        buff[j++] = waypt_dupe(wpt);
+        buff[j++] = new waypoint(*wpt);
       }
       track_del_wpt(track, wpt);
-      waypt_free(wpt);
+      delete wpt;
     }
     if (track != master) {     /* i > 0 */
       track_del_head(track);
@@ -542,7 +542,7 @@ trackfilter_merge(void)
       route_add_wpt(master, wpt);
       prev = wpt;
     } else {
-      waypt_free(wpt);
+      delete wpt;
       dropped++;
     }
   }
@@ -920,7 +920,7 @@ trackfilter_range(void)             /* returns number of track points left after filtering
 
       if (! inside) {
         track_del_wpt(track, wpt);
-        waypt_free(wpt);
+        delete wpt;
         dropped++;
       }
     }
index e8338141be44b8c432aeb88b71f97e9c535ff6ee..af5b79e83aca92ec1f3c2294d9815c235ddb44d2 100644 (file)
@@ -95,7 +95,7 @@ transform_waypoints(void)
     waypoint* wpt = (waypoint*) elem;
 #endif
 
-    wpt = waypt_dupe(wpt);
+    wpt = new waypoint(*wpt);
     switch (current_target) {
     case 'R':
       route_add_wpt_named(rte, wpt, RPT, name_digits);
@@ -153,7 +153,7 @@ transform_trk_disp_hdr_cb(const route_head* trk)
 static void
 transform_any_disp_wpt_cb(const waypoint* wpt)
 {
-  waypoint* temp = waypt_dupe(wpt);
+  waypoint* temp = new waypoint(*wpt);
   if (current_target == 'R') {
     route_add_wpt_named(current_rte, temp, current_namepart, name_digits);
   } else if (current_target == 'T') {
index 210bc2e49306f74333b4675d9224054a1aa46f92..bb23dbb41040e628f88578a41027c4170b5b9ac9 100644 (file)
@@ -655,7 +655,7 @@ unicsv_parse_one_line(char* ibuf)
   int ns = 1;
   int ew = 1;
   geocache_data* gc_data = NULL;
-  wpt = waypt_new();
+  wpt = new waypoint;
   wpt->latitude = unicsv_unknown;
   wpt->longitude = unicsv_unknown;
   memset(&ymd, 0, sizeof(ymd));
@@ -1040,7 +1040,7 @@ unicsv_parse_one_line(char* ibuf)
     case fld_gc_placer_id:
     case fld_gc_hint:
 
-      gc_data = waypt_alloc_gc_data(wpt);
+      gc_data = wpt->AllocGCData();
 
       switch (unicsv_fields_tab[column]) {
 
@@ -1107,7 +1107,7 @@ unicsv_parse_one_line(char* ibuf)
   }
 
   if (checked == 0) {
-    waypt_free(wpt);
+    delete wpt;
     return;
   }
 
@@ -1405,7 +1405,7 @@ unicsv_waypt_enum_cb(const waypoint* wpt)
     }
   }
 
-  if (! waypt_empty_gc_data(wpt)) {
+  if (! wpt->EmptyGCData()) {
     const geocache_data* gc_data = wpt->gc_data;
 
     if (gc_data->id) {
@@ -1766,7 +1766,7 @@ unicsv_waypt_disp_cb(const waypoint* wpt)
     unicsv_print_str(GMSD_GET(email, NULL));
   }
 
-  if (waypt_empty_gc_data(wpt)) {
+  if (wpt->EmptyGCData()) {
     gc_data = NULL;
   } else {
     gc_data = wpt->gc_data;
index 7a9cba311178fc77342520449331d0617c39b1ae..3c17b6676df8107faf041a7a76b5285c97c537e2 100644 (file)
@@ -300,7 +300,7 @@ v900_read(void)
       line.bas.cr = 0; /* null terminate vox field */
     }
 
-    wpt = waypt_new();
+    wpt = new waypoint;
 
     /* lat is a string in the form: 31.768380N */
     c = line.bas.common.latitude_NS;   /* N/S */
@@ -362,7 +362,7 @@ v900_read(void)
       // thread on gpsbabel-misc with Jamie Robertson.
       assert(line.bas.common.tag == 'C' || line.bas.common.tag == 'G' ||
              line.bas.common.tag == 'V');
-      wpt2 = waypt_dupe(wpt);
+      wpt2 = new waypoint(*wpt);
       if (line.bas.common.tag == 'V') {        // waypoint with voice recording?
         char vox_file_name[sizeof(line.adv.vox)+5];
         const char* vox = is_advanced_mode ? line.adv.vox : line.bas.vox;
index 08e63249d813bf180f2a473a9bf052612adf9a9b..335ec6ad109a4853aa7861408de10068437ae45f 100644 (file)
@@ -77,7 +77,7 @@ vidaone_read(void)
   route_head* trk = NULL;
 
   while (! gbfeof(fin)) {
-    waypoint* wpt = waypt_new();
+    waypoint* wpt = new waypoint;
 
     wpt->latitude = gbfgetdbl(fin);
     wpt->longitude = gbfgetdbl(fin);
index 57e7da36129f8ffbab6653b1274b1de178694e69..131e4830419c606c0af2ac270395faadd5797315 100644 (file)
@@ -154,7 +154,7 @@ vitosmt_read(void)
     gpsvalid   =gbfgetc(infile);       /* fix is valid */
     gpssats            =gbfgetc(infile);       /* number of sats */
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     wpt_tmp->latitude  =DEG(latrad);
     wpt_tmp->longitude =DEG(lonrad);
index b87a358be14b91edef94d99f2b9cf0ee18351f79..f672b9a8f11a6aab27d4b9d7ad71f1b61e025d0f 100644 (file)
@@ -103,7 +103,7 @@ vitovtt_read(void)
     course                             = gbfgetint16(infile);
     status                             = gbfgetint32(infile);
 
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     wpt_tmp->latitude  = scaled_lat / vitovtt_latitudescale;
     wpt_tmp->longitude = scaled_lon / vitovtt_longitudescale;
index 6af30185fd1afc6ae8ba97ce058ba4b903b1ab8d..97abf82ee191762b5a217d0a03579be30260bdd7 100644 (file)
@@ -195,7 +195,7 @@ vpl_parse_75_sentence(const char* ibuf)
   ymd /= 100;
   tm.tm_year = ymd % 100 + 100;
 
-  waypt = waypt_new();
+  waypt = new waypoint;
 
   // Lat/Lon are both stored *0xE1000 which we have to divide out
   // for decimal degrees
index 3f2f964b35ef21199af8c252aef111a747c49eb0..3f0071b9581aa9edf7e6c6cf84c84a657489adba 100644 (file)
@@ -59,14 +59,6 @@ waypt_init(void)
 #endif
 }
 
-// This whole thing is a poor-man's copy constructor. It exists mostly
-// as a bridge from our non-reference counted C types to classes now.
-waypoint*
-waypt_dupe(const waypoint* wpt)
-{
-  return new waypoint(*wpt);
-}
-
 void update_common_traits(const waypoint* wpt)
 {
   /* This is a bit tacky, but it allows a hint whether we've seen
@@ -159,16 +151,6 @@ waypt_del(waypoint* wpt)
 #endif
 }
 
-/*
- * A constructor for a single waypoint.
- */
-waypoint*
-waypt_new(void)
-{
-  waypoint* wpt = new waypoint;
-  return wpt;
-}
-
 unsigned int
 waypt_count(void)
 {
@@ -342,18 +324,12 @@ find_waypt_by_name(const QString& name)
   return NULL;
 }
 
-void
-waypt_free(waypoint* wpt)
-{
-  delete wpt;
-}
-
 #if NEWQ
 void
 waypt_flush(queue* head)
 {
   while (!waypt_list.isEmpty()) {
-    waypt_free(waypt_list.takeFirst());
+    delete waypt_list.takeFirst();
   }
 }
 #else
@@ -364,7 +340,7 @@ waypt_flush(queue* head)
 
   QUEUE_FOR_EACH(head, elem, tmp) {
     waypoint* q = (waypoint*) dequeue(elem);
-    waypt_free(q);
+    delete q;
     if (head == &waypt_head) {
       waypt_ct--;
     }
@@ -405,7 +381,7 @@ waypt_backup(signed int* count, queue** head_bak)
 
   QUEUE_FOR_EACH(qbackup, elem, tmp) {
     wpt = (waypoint*)elem;
-    waypt_add(waypt_dupe(wpt));
+    waypt_add(new waypoint(*wpt));
     no++;
   }
 
@@ -568,19 +544,6 @@ waypt_course(const waypoint* A, const waypoint* B)
   }
 }
 
-geocache_data*
-waypt_alloc_gc_data(waypoint* wpt)
-{
-  return wpt->AllocGCData();
-}
-
-int
-waypt_empty_gc_data(const waypoint* wpt)
-{
-  return wpt->EmptyGCData();
-}
-
-
 waypoint::waypoint() :
   // Q(),
   latitude(0),  // These should probably use some invalid data, but
index 1223f94b7c27409fdb10c8f1bf36bf82cfa694a0..8c02e84376d5e085853b2257d89828057d58cbd7 100644 (file)
@@ -543,7 +543,7 @@ static int check_date(uint32_t tim)
 static waypoint* make_point(double lat, double lon, double alt, time_t tim, const char* fmt, int index)
 {
   char     wp_name[20];
-  waypoint* wpt = waypt_new();
+  waypoint* wpt = new waypoint;
 
   sprintf(wp_name, fmt, index);
 
index c58b67a22fc36d73c3bbf9e3e05528a5e2726ba7..48721d3418072b3fea3715243a0da1f7431b1bc4 100644 (file)
@@ -223,7 +223,7 @@ void wfff_e(xg_string args, const QXmlStreamAttributes* unused)
   char         desc[255]       ="\0";
 
   if ((ap_hdop>=1)&&(ap_hdop<50)) { // Discard invalid GPS fix
-    wpt_tmp = waypt_new();
+    wpt_tmp = new waypoint;
 
     if (snmac) {
       wpt_tmp->shortname = ap_mac;
index 71cb009cb9f4faf4d0ef661e5b749e7ce2fe70d5..1348e464f181c9885937a2c4a1b568001d3d8759 100644 (file)
@@ -68,7 +68,7 @@ wintec_tes_read(void)
     int16_t alt = gbfgetint16(fin);  // Signed.  Meters.
 
     (void) flags; // Silence 'unused' warning until we use flags.
-    wpt = waypt_new();
+    wpt = new waypoint;
     wpt->latitude = latitude / 1.0e7;
     wpt->longitude = longitude / 1.0e7;
     wpt->SetCreationTime(wintec_date_to_time(date));
@@ -85,7 +85,7 @@ wintec_tes_read(void)
     //  Wintec's software puts a waypoint in the track, so we
     //  mock that.
     if (flags &  0x02) {
-      waypoint* temp = waypt_dupe(wpt);
+      waypoint* temp = new waypoint(*wpt);
       waypt_add(temp);
     }
 
index fa7ba5dc0748a1be5c2995e7e8ae20f6740023dd..352957db9074ed14ddfb021b908af5ead5fd3eff 100644 (file)
@@ -70,7 +70,7 @@ xol_shape(xg_string args, const QXmlStreamAttributes* attrv)
 {
   if (attrv->hasAttribute("type")) {
     if (attrv->value("type") == "waypoint") {
-      wpt = waypt_new();
+      wpt = new waypoint;
     } else if (attrv->value("type") == "polyline") {
       trk = route_head_alloc();
       track_add_head(trk);
index dfd2e8ee1630ffda22cb8f262ce5ce0b2b26133b..ce153cc3ba318f9d3afc51edf275f9322dfba21f 100644 (file)
@@ -81,7 +81,7 @@ yahoo_wr_init(const char* fname)
 
 void   wpt_s(xg_string args, const QXmlStreamAttributes* unused)
 {
-  wpt_tmp = waypt_new();
+  wpt_tmp = new waypoint;
 }
 
 void   wpt_e(xg_string args, const QXmlStreamAttributes* unused)